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,6 +8,9 @@ _minecraft_server() {
disable enable status show sync send screen watch logrotate backup
map overviewer update"
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)
@ -18,8 +21,7 @@ _minecraft_server() {
*)
;;
esac
COMPREPLY=($(compgen -W "$OPTS" -- $CUR))
fi
return 0
}
complete -F _minecraft_server /etc/init.d/minecraft_server