[BACK]Return to mtctl-completion.bash CVS log [TXT][DIR] Up to [local] / mtctl

Annotation of mtctl/mtctl-completion.bash, Revision 1.1

1.1     ! bountyht    1: _mtctl_completions() {
        !             2:         case $COMP_CWORD in
        !             3:                 1) local suggestions=($(compgen -W "start stop restart status create list version help" -- "${COMP_WORDS[1]}"))
        !             4:                 ;;
        !             5:                 2) if [ "${COMP_WORDS[1]}" == "help" ] || [ "${COMP_WORDS[1]}" == "list" ] || [ "${COMP_WORDS[1]}" == "version" ]; then return; fi
        !             6:                        local suggestions=($(cd {WORLDFOLDER} && compgen -d "${COMP_WORDS[2]}"))
        !             7:                 ;;
        !             8:                *) return
        !             9:                ;;
        !            10:         esac
        !            11:         if [ "${#suggestions[@]}" == "1" ]; then
        !            12:                 local number=$(echo ${suggestions[0]/%\ */})
        !            13:                 COMPREPLY=("$number")
        !            14:         else
        !            15:                 COMPREPLY=("${suggestions[@]}")
        !            16:         fi
        !            17: }
        !            18:
        !            19: complete -F _mtctl_completions mtctl
        !            20:

CVSweb