-
-
Notifications
You must be signed in to change notification settings - Fork 20
Tab completion
Intake supports providing argument auto-completion suggestions.
CommandCallable
implements CommandCompleter
, which defines
List<String> getSuggestions(String arguments, CommandLocals locals)
Implementations do have to parse the arguments, which may contain values for several parameters. The list of suggestions is ultimately returned to your calling code, so you can handle it however you want. In Intake though, convention is to return a list of possible arguments that can be completed without removing any characters that have been typed.
For example, if the user has typed t
, then suggestions would include "teleport" and "tp", including the typed letter(s).
Dispatchers should generally implement suggestions to auto-complete sub-commands.
SimpleDispatcher
in Intake will complete sub-commands and also use testPermission()
to hide commands that the user cannot use.