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

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

1.1       bountyht    1: _mtctl_completions() {
                      2:         case $COMP_CWORD in
1.2       minionto    3:                 1) local suggestions=($(compgen -W "start stop restart status create backup list version help" -- "${COMP_WORDS[1]}"))
1.1       bountyht    4:                 ;;
                      5:                 2) if [ "${COMP_WORDS[1]}" == "help" ] || [ "${COMP_WORDS[1]}" == "list" ] || [ "${COMP_WORDS[1]}" == "version" ]; then return; fi
1.3     ! minionto    6: local suggestions=($(cd $(cat $HOME/.mtctl/config | grep 'location' | sed -e 's/location\=//')/worlds && compgen -d "${COMP_WORDS[2]}"))
1.1       bountyht    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

CVSweb