1
0
mirror of synced 2026-01-26 03:41:32 +00:00

2006-06-11 07:33:45 by steve

Added completion for the xt-* commands.
This commit is contained in:
steve
2006-06-11 07:33:45 +00:00
parent aac2332482
commit 38720acacf

View File

@@ -20,7 +20,7 @@
# --
# http://www.steve.org.uk
#
# $Id: xen-tools,v 1.24 2006-06-11 07:21:19 steve Exp $
# $Id: xen-tools,v 1.25 2006-06-11 07:33:45 steve Exp $
#
@@ -38,7 +38,7 @@ _xen_create_image()
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts='--broadcast --boot --debug --debootstrap --dhcp --dir --dist --force --fs --gateway --help --hostname --ide --ip --initrd --kernel --lvm --manual --memory --mirror --passwd --role --rpmstrap --size --swap --version'
opts='--broadcast --boot --cache --debug --debootstrap --dhcp --dir --dist --force --fs --gateway --help --hostname --ide --ip --initrd --kernel --lvm --manual --memory --mirror --passwd --role --rpmstrap --size --swap --version'
#
@@ -58,6 +58,10 @@ _xen_create_image()
vgs=`vgdisplay | grep Name | awk '{print $3}'`
case "$prev" in
--cache)
COMPREPLY=( $( compgen -W 'yes no' -- "${COMP_WORDS[COMP_CWORD]}" ) )
return 0
;;
--dir)
_filedir -d
return 0
@@ -256,3 +260,130 @@ _xen_list_images()
fi
}
complete -F _xen_list_images xen-list-images
#
# Completion for xt-create-xen-config
#
_xt-create-xen-config()
{
local cur prev
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts='--help --manual --output --verbose --version'
case "$prev" in
--output)
_filedir -d
return 0
;;
esac
if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _xt-create-xen-config xt-create-xen-config
#
# Completion for xt-customize-image
#
_xt-customize-image()
{
local cur prev dists
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts='--dist --help --location --manual --output --verbose --version'
#
# Available distributions, from rpmstrap
#
if [ -d /usr/lib/rpmstrap/scripts ]; then
dists=`ls -1 /usr/lib/rpmstrap/scripts`
fi
case "$prev" in
--location)
_filedir -d
return 0
;;
--dist)
COMPREPLY=( $( compgen -W '${dists} sid sarge etch' -- "${COMP_WORDS[COMP_CWORD]}" ) )
return 0
;;
esac
if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _xt-customize-image xt-customize-image
#
# Completion for xt-install-image
#
#
_xt-install-image()
{
local cur prev ip roles dists
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
opts='--copy --cache --debootstrap --dist --help --location --manual --mirror --rpmstrap --tar --verbose --version'
#
# Complete the initial part of the IP in the configuration file.
ip=`grep ^gateway /etc/xen-tools/xen-tools.conf | awk -F'= ' '{print $2}'`
#
# Available distributions, from rpmstrap
#
if [ -d /usr/lib/rpmstrap/scripts ]; then
dists=`ls -1 /usr/lib/rpmstrap/scripts`
fi
case "$prev" in
--cache)
COMPREPLY=( $( compgen -W 'yes no' -- "${COMP_WORDS[COMP_CWORD]}" ) )
return 0
;;
--copy)
_filedir -d
return 0
;;
--dist)
COMPREPLY=( $( compgen -W '${dists} sid sarge etch' -- "${COMP_WORDS[COMP_CWORD]}" ) )
return 0
;;
--location)
_filedir -d
return 0
;;
--tar)
_filedir 'tar'
return 0
;;
esac
if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _xt-install-image xt-install-image