1
0
mirror of synced 2026-02-13 10:54:09 +00:00
Files
xen-tools.xen-tools/misc/xen-tools
steve 71918cceb6 2005-12-21 02:26:21 by steve
Added completion for the --debug flag.
2005-12-21 02:26:21 +00:00

71 lines
1.4 KiB
Plaintext

#
# /etc/bash_completion.d/xen-tools
#
# Completion functions for Bash.
#
# Steve
# --
# http://www.steve.org.uk
#
# $Id :$
#
#
# Completion for xen-create-image
#
# Completes the command line flags, and will allow tab completion of
# the supported filesystems
#
_xen-create-image()
{
local cur prev i exprfound onlyonce
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
--fs)
COMPREPLY=( $( compgen -W 'fs ext3 reiserfs' -- \
"${COMP_WORDS[COMP_CWORD]}" ) )
return 0
;;
--dist)
COMPREPLY=( $( compgen -W 'sid sarge etch' -- \
"${COMP_WORDS[COMP_CWORD]}" ) )
return 0
;;
esac
_expand || return 0
# complete using basic options
COMPREPLY=( $( compgen -W '--broadcast --boot --debug --dhcp --dir --dist --fs --gateway --help --hostname --ip --manual --memory --network --netmask --mirror --size --swap' -- $cur ) )
COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
(while read -d ' ' i; do
[ "$i" == "" ]
continue
# flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of
# first and last word
COMPREPLY=" ${COMPREPLY[@]} "
# remove word from list of completions
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
done
echo ${COMPREPLY[@]})
) )
_filedir
return 0
}
complete -F _xen-create-image $filenames xen-create-image