Interface Command
- All Known Implementing Classes:
AbstractCommand,Clear,ConsumerCommandAdapter,FunctionCommandAdapter,Help,History,MethodInvokerCommandAdapter,Script,Version
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
- Author:
- Eric Bottard, Piotr Olaszewski, Mahmoud Ben Hassine
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classBuilder for creating command. -
Method Summary
Modifier and TypeMethodDescriptionstatic Command.Builderbuilder()Creates and returns a new instance of aBuilderfor defining and constructing commands.execute(CommandContext commandContext) Execute the command within the given context.Get the aliases of the command.default List<CommandArgument>Get the arguments of the command.default AvailabilityProviderGet the availability provider of the command.default CompletionProviderGet the completion provider of the command.default StringGet a short description of the command.default StringgetGroup()Get the group of the command.default StringgetHelp()Get the help text of the command.default StringgetName()Get the name of the command.default List<CommandOption>Get the options of the command.default booleanisHidden()Check if the command is hidden.
-
Method Details
-
getName
Get the name of the command.- Returns:
- the name of the command
-
getDescription
Get a short description of the command.- Returns:
- the description of the command
-
getHelp
Get the help text of the command.- Returns:
- the help text of the command
-
isHidden
default boolean isHidden()Check if the command is hidden.- Returns:
- true if the command is hidden, false otherwise
-
getGroup
Get the group of the command.- Returns:
- the group of the command
-
getAliases
Get the aliases of the command.- Returns:
- the aliases of the command
-
getOptions
Get the options of the command.- Returns:
- the options of the command
-
getArguments
Get the arguments of the command.- Returns:
- the arguments of the command
-
getAvailabilityProvider
Get the availability provider of the command. Defaults to always available.- Returns:
- the availability provider of the command
-
getCompletionProvider
Get the completion provider of the command.- Returns:
- the completion provider of the command
-
execute
Execute the command within the given context.- Parameters:
commandContext- the context of the command- Returns:
- the exit status of the command
- Throws:
Exception
-
builder
Creates and returns a new instance of aBuilderfor defining and constructing commands.The builder allows customization of command properties such as name, description, group, help text, aliases, and execution logic.
- Returns:
- a new
Builderinstance for configuring and creating commands
-