Interface CommandRegistration.Builder
- All Known Implementing Classes:
CommandRegistration.BaseBuilder
,CommandRegistration.DefaultBuilder
- Enclosing interface:
- CommandRegistration
public static interface CommandRegistration.Builder
Builder interface for
CommandRegistration
.-
Method Summary
Modifier and TypeMethodDescriptionavailability
(Supplier<Availability> availability) Define anAvailability
suppliear for a command.build()
Builds aCommandRegistration
.Define commands this registration uses.defaultOptionNameModifier
(Function<String, String> modifier) Provides a global option name modifier.description
(String description) Define a description text for a command.Define a group for a command.hidden()
Define a command to be hidden.hidden
(boolean hidden) Define a command to be hidden by a given flag.DefineInteractionMode
for a command.Define an alias what this command should executeDefine an error handling what this command should useDefine an exit code what this command should executeDefine help options what this command should use.Define an option what this command should user for.Define a target what this command should execute
-
Method Details
-
command
Define commands this registration uses. Essentially defines a full set of main and sub commands. It doesn't matter if full command is defined in one string or multiple strings as "words" are splitted and trimmed with whitespaces. You will get result ofcommand subcommand1 subcommand2, ...
.- Parameters:
commands
- the commands- Returns:
- builder for chaining
-
interactionMode
DefineInteractionMode
for a command.- Parameters:
mode
- the interaction mode- Returns:
- builder for chaining
-
description
Define a description text for a command.- Parameters:
description
- the description text- Returns:
- builder for chaining
-
availability
Define anAvailability
suppliear for a command.- Parameters:
availability
- the availability- Returns:
- builder for chaining
-
group
Define a group for a command.- Parameters:
group
- the group- Returns:
- builder for chaining
-
defaultOptionNameModifier
Provides a global option name modifier. Will be used with all options to modify long names. Usual use case is to enforce naming convention i.e. to havesnake-case
for all names.- Parameters:
modifier
- to modifier to change option name- Returns:
- builder for chaining
-
withOption
CommandRegistration.OptionSpec withOption()Define an option what this command should user for. Can be used multiple times.- Returns:
- option spec for chaining
-
withTarget
CommandRegistration.TargetSpec withTarget()Define a target what this command should execute- Returns:
- target spec for chaining
-
withAlias
CommandRegistration.AliasSpec withAlias()Define an alias what this command should execute- Returns:
- alias spec for chaining
-
withExitCode
CommandRegistration.ExitCodeSpec withExitCode()Define an exit code what this command should execute- Returns:
- exit code spec for chaining
-
withErrorHandling
CommandRegistration.ErrorHandlingSpec withErrorHandling()Define an error handling what this command should use- Returns:
- error handling spec for chaining
-
withHelpOptions
CommandRegistration.HelpOptionsSpec withHelpOptions()Define help options what this command should use.- Returns:
- help options spec for chaining
-
build
CommandRegistration build()Builds aCommandRegistration
.- Returns:
- a command registration
-