summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
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