From d39f4fe8ec41357c496fcbd40645a898e1e37c12 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 30 Jan 2008 19:05:33 +0000 Subject: [PATCH] Better bash completion for xen-create-image, by Nick Anderson. --- AUTHORS | 3 +++ misc/xen-tools | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index fc1f6c0..2de5b22 100644 --- a/AUTHORS +++ b/AUTHORS @@ -14,6 +14,9 @@ Contributions C.J. Adams-Collier + - Better bash completion for xen-create-image. + Ray Anthracite - Added support for EVMS installation types. diff --git a/misc/xen-tools b/misc/xen-tools index d794228..09a508c 100644 --- a/misc/xen-tools +++ b/misc/xen-tools @@ -133,7 +133,7 @@ _xen_create_image() return 0 ;; --role) - roles=$(for x in `/bin/ls -1 /etc/xen-tools/role.d/ 2>/dev/null | grep -v \/ 2>/dev/null`; do echo ${x} ; done ) + roles=$(ls -1 /etc/xen-tools/role.d/ | xargs echo ) COMPREPLY=( $( compgen -W '${roles}' -- "${COMP_WORDS[COMP_CWORD]}" ) ) return 0 ;; @@ -144,7 +144,7 @@ _xen_create_image() ;; esac - if [[ ${cur} == -* ]]; then + if [[ ${cur} == -* ]] || [[ ${prev} == xen-create-image ]]; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 fi