aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/bash-completion
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-04 11:48:10 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-04 11:48:10 +0100
commit9136a919b19929ecb242ef327053d55d824397df (patch)
tree39980ce2c3f3cdb05606b0ac5d73fcc76343c2d9 /tools/libxl/bash-completion
parent817ad21addc8b9a345c864883057e2a818f6afdc (diff)
downloadxen-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-completion21
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