summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-07-23 10:44:36 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-07-23 10:44:36 -0400
commit13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7 (patch)
treed4735c9d0d46100bc828f6fd01b34d84fe7e2fde /config
parent5b5ec9a634d0c21f19e4caf043a37afda8ef3e05 (diff)
downloadcobbler-13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7.tar.gz
cobbler-13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7.tar.xz
cobbler-13faf52cb2f6fce533bdc0d4ef1e0166b4273eb7.zip
bash completion upgrades
Diffstat (limited to 'config')
-rw-r--r--config/cobbler_bash40
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