mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
42 lines
692 B
Plaintext
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 |