@@ -, +, @@ - Run (on the vagrant user): $ source kohaclone/debian/koha-common.bash-completion - Run: $ sudo koha-zebra - ( means press the tab key) - Sign off :-D --- debian/koha-common.bash-completion | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) --- a/debian/koha-common.bash-completion +++ a/debian/koha-common.bash-completion @@ -271,6 +271,43 @@ _koha-indexer() } complete -F _koha-indexer koha-indexer +_koha-zebra() +{ + local cur opts substract + + COMPREPLY=() + _get_comp_words_by_ref cur + opts="--start --stop --restart --status --quiet -q --help -h" + + # Build a list of the already used option switches + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == -* ]]; then + case ${COMP_WORDS[i]} in + --start) _koha_list_cmd ; return 0 ;; + --stop) _koha_list_cmd ; return 0 ;; + --restart) _koha_list_cmd ; return 0 ;; + --status) _koha_list_cmd ; return 0 ;; + --help) COMPREPLY=() ; return 0 ;; # no more completions + -h) COMPREPLY=() ; return 0 ;; # no more completions + --quiet) # filter the other quiet switches and go on + substract="$substract -e -q"; ;; + -q) # filter the other quiet switches and go on + substract="$substract -e --quiet"; ;; + esac + substract="$substract -e ${COMP_WORDS[i]}" + fi + done + + if [[ "$substract" != "" ]]; then + opts=$( echo $opts | sed -e 's/ /\n/g' | grep -v -x $substract ) + fi + + COMPREPLY=( $(compgen -W "$opts" -- $cur ) ) + + return 0 +} +complete -F _koha-zebra koha-zebra + # Local variables: # mode: shell-script # sh-basic-offset: 4 --