1
0
mirror of synced 2026-01-22 10:11:28 +00:00

2005-12-23 01:21:22 by steve

Added more completion options.
This commit is contained in:
steve 2005-12-23 01:21:22 +00:00
parent 9e47888b01
commit 8008d92d0a

26
misc/xm
View File

@ -7,7 +7,7 @@
# --
# http://www.steve.org.uk
#
# $Id: xm,v 1.1 2005-12-23 01:06:00 steve Exp $
# $Id: xm,v 1.2 2005-12-23 01:21:22 steve Exp $
#
@ -21,24 +21,44 @@ _xm()
#
# The basic options we'll complete.
#
opts="console create list shutdown"
opts="console create destroy help list pause reboot shutdown top unpause"
#
# Complete the arguments to some of the basic commands.
#
case "${prev}" in
console)
local running=$(for x in `xm list --long | grep \(name | grep -v Domain-0 | awk '{ print $2 }' | tr -d \)`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0
;;
create)
local names=$(for x in `ls -1 /etc/xen/*.cfg`; do echo ${x/\/etc\/xen\//} ; done )
COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
return 0
;;
destroy)
local running=$(for x in `xm list --long | grep \(name | grep -v Domain-0 | awk '{ print $2 }' | tr -d \)`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0
;;
pause)
local running=$(for x in `xm list --long | grep \(name | grep -v Domain-0 | awk '{ print $2 }' | tr -d \)`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0
;;
reboot)
local running=$(for x in `xm list --long | grep \(name | grep -v Domain-0 | awk '{ print $2 }' | tr -d \)`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0
;;
shutdown)
local running=$(for x in `xm list --long | grep \(name | grep -v Domain-0 | awk '{ print $2 }' | tr -d \)`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0
;;
console)
unpause)
local running=$(for x in `xm list --long | grep \(name | grep -v Domain-0 | awk '{ print $2 }' | tr -d \)`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0