Default to the OPTS list only on the first COMP_CWORD

This commit is contained in:
Jason M. Wood 2013-12-02 13:10:18 -07:00
parent 0cf40a409d
commit 8a6d99aeee

View File

@ -8,7 +8,10 @@ _minecraft_server() {
disable enable status show sync send screen watch logrotate backup
map overviewer update"
case "$PREV" in
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($(compgen -W "$OPTS" -- $CUR))
else
case "$PREV" in
start|stop|force-stop|restart|force-restart|delete|remove|disable|\
sync|send|screen|watch|logrotate|backup|map|overviewer)
local WORLDS="world"
@ -17,9 +20,8 @@ _minecraft_server() {
;;
*)
;;
esac
COMPREPLY=($(compgen -W "$OPTS" -- $CUR))
esac
fi
return 0
}
complete -F _minecraft_server /etc/init.d/minecraft_server