diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-04 11:48:10 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-04 11:48:10 +0100 |
commit | 9136a919b19929ecb242ef327053d55d824397df (patch) | |
tree | 39980ce2c3f3cdb05606b0ac5d73fcc76343c2d9 /tools/libxl/bash-completion | |
parent | 817ad21addc8b9a345c864883057e2a818f6afdc (diff) | |
download | xen-9136a919b19929ecb242ef327053d55d824397df.tar.gz xen-9136a919b19929ecb242ef327053d55d824397df.tar.bz2 xen-9136a919b19929ecb242ef327053d55d824397df.zip |
xl: Add basic bash completion for xl command.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Diffstat (limited to 'tools/libxl/bash-completion')
-rw-r--r-- | tools/libxl/bash-completion | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/libxl/bash-completion b/tools/libxl/bash-completion new file mode 100644 index 0000000000..4b870e6602 --- /dev/null +++ b/tools/libxl/bash-completion @@ -0,0 +1,21 @@ +#!/bin/bash +# Copy this file to /etc/profile.d/xl.sh + +_xl() +{ + local IFS=$'\n,' + + local cur opts xl + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + xl=xl + + if [[ $COMP_CWORD == 1 ]] ; then + opts=`${xl} help 2>/dev/null | sed 'n;d' | sed '1,2d' | awk '{print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + return 0 +} + +complete -F _xl -o nospace -o default xl |