diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-07-23 10:44:36 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-07-23 10:44:36 -0400 |
commit | 13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7 (patch) | |
tree | d4735c9d0d46100bc828f6fd01b34d84fe7e2fde /config/cobbler_bash | |
parent | 5b5ec9a634d0c21f19e4caf043a37afda8ef3e05 (diff) | |
download | cobbler-13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7.tar.gz cobbler-13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7.tar.xz cobbler-13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7.zip |
bash completion upgrades
Diffstat (limited to 'config/cobbler_bash')
-rw-r--r-- | config/cobbler_bash | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/config/cobbler_bash b/config/cobbler_bash index 0de7e2a6..9b558721 100644 --- a/config/cobbler_bash +++ b/config/cobbler_bash @@ -42,16 +42,28 @@ _cobbler() if [ -n "$special" ] then # Take care of sub commands - SPECIALSUB_CMDS=`cobbler $special --helpbash | sed "s/ /|/g"` - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[i]} == @(${SPECIALSUB_CMDS}) ]]; then - specialsub=${COMP_WORDS[i]} - break - fi - done + SPECIALSUB_CMDS=`cobbler $special --helpsubs | sed "s/ /|/g"` + if [ -n "${SPECIALSUB_CMDS}" ] ; then + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(${SPECIALSUB_CMDS}) ]]; then + specialsub=${COMP_WORDS[i]} + break + fi + done + else + # This command has no subcommands + COMPREPLY=( $( compgen -f -W '$( cobbler $special --helpopts )' -- $cur ) ) + return 0 + fi - COMPREPLY=( $( compgen -W '$( cobbler $special $specialsub --helpbash )' -- $cur ) ) - return 0 + if [ -n "$specialsub" ] + then + COMPREPLY=( $( compgen -f -W '$( cobbler $special $specialsub --helpopts )' -- $cur ) ) + return 0 + else + COMPREPLY=( $( compgen -W '$( cobbler $special --helpsubs )' -- $cur ) ) + return 0 + fi fi case $cur in @@ -71,16 +83,6 @@ _cobbler() 1) COMPREPLY=( $( compgen -W '$( cobbler --helpbash )' -- $cur ) ) ;; - *) - case $prev in - distro|profile|repo|system|image) - COMPREPLY=( $( compgen -W 'add edit copy list rename remove report' -- $cur ) ) - ;; - *) - _filedir - ;; - esac - ;; esac } complete -F _cobbler cobbler |