Return to mtctl-completion.bash CVS log | Up to [local] / mtctl |
File: [local] / mtctl / mtctl-completion.bash (download)
Revision 1.1.1.1 (vendor branch), Tue Aug 31 17:00:08 2021 UTC (2 years, 8 months ago) by bountyht
Initial version from Miniontoby |
_mtctl_completions() { case $COMP_CWORD in 1) local suggestions=($(compgen -W "start stop restart status create list version help" -- "${COMP_WORDS[1]}")) ;; 2) if [ "${COMP_WORDS[1]}" == "help" ] || [ "${COMP_WORDS[1]}" == "list" ] || [ "${COMP_WORDS[1]}" == "version" ]; then return; fi local suggestions=($(cd {WORLDFOLDER} && compgen -d "${COMP_WORDS[2]}")) ;; *) return ;; esac if [ "${#suggestions[@]}" == "1" ]; then local number=$(echo ${suggestions[0]/%\ */}) COMPREPLY=("$number") else COMPREPLY=("${suggestions[@]}") fi } complete -F _mtctl_completions mtctl