We currently migrate to MediaWiki from our old installation, but not all content has been migrated yet. Take a look at the Wiki Team page for instructions how to help or browse through our new wiki at wiki.linux-vserver.org to find the information already migrated.

For test it, push the source in your .bashrc or put it in the file /etc/bash_completion.d/vserver (Debian).

This release (0.3) supports the command vserver vapt-get vrpm vyum vserver-copy.

# Completion for the vserver command. Source this file (or on some systems
# add it to ~/.bash_completion and start a new shell) and bash's completion
# mechanism will know all about vserver's options!

# If bash completion is not enabled on your system at all, please do a
#  . /etc/bash_completion
# you can put this line in your .bashrc of course.

# Known to work with bash 2.05a with programmable completion and extended
# pattern matching enabled (use 'shopt -s extglob progcomp' to enable
# these if they are not already enabled).

# version 0.3

: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
test -e "$UTIL_VSERVER_VARS" && {

. "$UTIL_VSERVER_VARS"
. "$_LIB_FUNCTIONS"

_vserver()
{
	local cur cmds cmdOpts helpCmds names names_pipe func i

	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}

	# find available v-servers: 
	# call function getAllVservers in vserver library
	getAllVservers names
	names_pipe=`echo ${names[@]} | sed 's/ /|/g'`

	# available commands
	cmds='start stop restart condrestart suexec exec enter chkconfig\
		running status build unify pkg apt-get apt-config apt-cache\
		rpm pkgmgmt'

	# options (long and short name)
	cmdOpts='--help --version --debug --defaulttty -s --sync -v \ 
		   --verbose --silent --'

	# if the previous option is a single option 
	helpCmds='--help|--version'
	if [[ ${COMP_WORDS[1]} == @($helpCmds) ]] ; then
		return 0
	fi
	
	# search a verser's name
	for (( i=0; i <  ${#COMP_WORDS[@]}-1; i++ )); do
        	if [[ ${COMP_WORDS[i]} == @($names_pipe) ]];  then
			# it's found
			break
		fi
        done
	
	if (( $i < ${#COMP_WORDS[@]}-1 )) ; then 
		case ${COMP_WORDS[i+1]} in
		start)
			COMPREPLY=( $( compgen -W "--rescue --rescue-cmd" -- $cur ) )
			;;
		# No completion for apt-config
		stop|restart|condrestart|enter|running|status|apt-config)
			;;
		suexec)
			# I don't know how to do
			COMPREPLY=( $( compgen -W  -- $cur ) )
			;;
		exec)
			# I don't know how to do
			COMPREPLY=( $( compgen -W "" -- $cur ) )
			;;
		build)
			
			COMPREPLY=( $( compgen -W "" -- $cur ) )
			;;
		unify)
			COMPREPLY=( $( compgen -W "-R" -- $cur ) )
			;;
		apt-get|apt-cache)
			func=${COMP_WORDS[i+1]}
			COMP_WORDS=( ${COMP_WORDS[@]:$((i+1))} )
			COMP_CWORD=$((COMP_CWORD-i-1))
			declare -f _${func//-/_} > /dev/null && _${func//-/_}
			;;
		*)
			COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )	
			;;
		esac
		return 0
	else
		COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
		return 0
	fi

	return 0
}
complete -F _vserver vserver

_vapt_rpm_yum()
{
	local cur cmds cmdOpts helpCmds names func i

	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}

	# options (long and short name)
	cmdOpts='--help --version --quiet -q --all'

	# if the previous option is a single option 
	helpCmds='--help|--version'
	if [[ "${COMP_WORDS[1]}" == "@($helpCmds)" ]] ; then
		return 0
	fi

	# search --
	for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
        	if [[ ${COMP_WORDS[i]} = "--" ]];  then
			# it's found
			break
		fi
        done

	# find available v-servers: 
	# call function getAllVservers in vserver library
	getAllVservers names
	names_pipe=`echo ${names[@]}" --all" | sed 's/ /|/g'`
	
	#echo "i=$i"
	#echo "COMP_CWORD=$COMP_CWORD"

	if (( $i < ${#COMP_WORDS[@]}-1 )) && (( $i < $COMP_CWORD )) ; then 
		func=${COMP_WORDS[0]:1}
		COMP_WORDS=( $func ${COMP_WORDS[@]:$((i+1))} )
		COMP_CWORD=$((COMP_CWORD-i))
		declare -f _${func//-/_} > /dev/null && _${func//-/_}
	else	
		# search a verser's name
		for (( i=0; i <  ${#COMP_WORDS[@]}-1; i++ )); do
        		if [[ ${COMP_WORDS[i]} == @($names_pipe) ]];  then
				# it's found
				break
			fi
        	done

		if (( $i < ${#COMP_WORDS[@]}-1 )) ; then 
			if [[ "${COMP_WORDS[i]}" = "--all"  ]]; then
				cmdOpts='--'
				COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
			else
				cmdOpts='--'
				COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
			fi
		else
			COMPREPLY=( $( compgen -W "truc ${names[@]} $cmdOpts" -- $cur ) )
		fi
	fi
	return 0
}
complete -F _vapt_rpm_yum vapt-get
complete -F _vapt_rpm_yum vrpm
complete -F _vapt_rpm_yum vyum


_vserver_copy()
{
	local cur prev cmdOpts helpCmds confCmds names names_pipe i

	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}

	# find available v-servers: 
	# call function getAllVservers in vserver library
	getAllVservers names
	names_pipe=`echo ${names[@]} | sed 's/ /|/g'`

	# options (long and short name)
	cmdOpts='--help -h --version -V --verbose -v --quiet -q \ 
		   --vsroot -r --rsh -R --stopstart -s \
		   --domain -d --ip -i'

	# if the previous option is a single option 
	helpCmds='--help|-h|--version|-V'
	if [[ ${COMP_WORDS[1]} == @($helpCmds) ]] ; then
		return 0
	fi
	
	confCmds='--ip|-i|--domain|-d'
	prev=${COMP_WORDS[COMP_CWORD-1]}
	if [[ $prev == @($confCmds) ]]; then
		return 0
	fi

	# search a verser's name
	for (( i=0; i <  ${#COMP_WORDS[@]}-1; i++ )); do
        	if [[ ${COMP_WORDS[i]} == @($names_pipe) ]];  then
			# it's found
			break
		fi
        done
	
	if (( $i < ${#COMP_WORDS[@]}-1 )) ; then 
		return 0
	else
		COMPREPLY=( $( compgen -W "${names[@]} $cmdOpts" -- $cur ) )
	fi
	return 0
}
complete -F _vserver_copy vserver-copy

}

Hint: to the upsream author: I changed lines 38 and 44 !

Re: Hint: The changes at the lines 38 and 44 doesn't work. The first release has been reverted.