msm/bash_completion/msm
2012-05-31 07:06:31 +01:00

42 lines
692 B
Plaintext

_msm() {
source "/etc/msm.conf"
local base current options
COMPREPLY=()
current="${COMP_WORDS[$COMP_CWORD]}"
base="${COMP_WORDS[1]}"
if [[ $COMP_CWORD -gt 1 ]]; then
case "$base" in
start)
# Do nothing there is no more
;;
stop)
if [[ $COMP_CWORD == 2 ]]; then
options="now"
fi
;;
restart)
if [[ $COMP_CWORD == 2 ]]; then
options="now"
fi
;;
server)
;;
jargroup)
;;
*)
# Server options
;;
esac
else
local servers=$(ls -1 $SERVER_STORAGE_PATH)
options="help start stop restart server jargroup $servers"
fi
COMPREPLY=( $(compgen -W "${options}" -- ${current}) )
return 0
}
complete -F _msm msm