- java.lang.Object
-
- org.jline.shell.CommandDescription.Builder
-
- Enclosing class:
- CommandDescription
public static class CommandDescription.Builder extends java.lang.ObjectBuilder forCommandDescriptioninstances.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandDescription.Builderargument(ArgumentDescription argument)Adds an argument description.CommandDescription.Builderarguments(java.util.List<ArgumentDescription> arguments)Sets all argument descriptions.CommandDescriptionbuild()Builds the command description.CommandDescription.Buildercommand(boolean command)Sets whether this description represents a command.CommandDescription.BuildererrorIndex(int errorIndex)Sets the error index.CommandDescription.BuildererrorPattern(java.util.regex.Pattern errorPattern)Sets the error pattern.CommandDescription.Builderhighlighted(boolean highlighted)Sets whether the command should be highlighted.CommandDescription.BuildermainDescription(java.util.List<org.jline.utils.AttributedString> mainDescription)Sets the main description.CommandDescription.Builderoption(java.lang.String key, java.util.List<org.jline.utils.AttributedString> description)Adds an option with its description.CommandDescription.Builderoptions(java.util.Map<java.lang.String,java.util.List<org.jline.utils.AttributedString>> options)Sets all options.CommandDescription.Buildersubcommand(boolean subcommand)Sets whether this description represents a subcommand.CommandDescription.Buildervalid(boolean valid)Sets whether this description is valid.
-
-
-
Method Detail
-
mainDescription
public CommandDescription.Builder mainDescription(java.util.List<org.jline.utils.AttributedString> mainDescription)
Sets the main description.- Parameters:
mainDescription- the description lines- Returns:
- this builder
-
argument
public CommandDescription.Builder argument(ArgumentDescription argument)
Adds an argument description.- Parameters:
argument- the argument description- Returns:
- this builder
-
arguments
public CommandDescription.Builder arguments(java.util.List<ArgumentDescription> arguments)
Sets all argument descriptions.- Parameters:
arguments- the argument descriptions- Returns:
- this builder
-
option
public CommandDescription.Builder option(java.lang.String key, java.util.List<org.jline.utils.AttributedString> description)
Adds an option with its description.- Parameters:
key- the option syntax (e.g., "-l --long")description- the option description- Returns:
- this builder
-
options
public CommandDescription.Builder options(java.util.Map<java.lang.String,java.util.List<org.jline.utils.AttributedString>> options)
Sets all options.- Parameters:
options- the options map- Returns:
- this builder
-
valid
public CommandDescription.Builder valid(boolean valid)
Sets whether this description is valid.- Parameters:
valid- true if valid- Returns:
- this builder
-
command
public CommandDescription.Builder command(boolean command)
Sets whether this description represents a command.- Parameters:
command- true if this is a command description- Returns:
- this builder
-
subcommand
public CommandDescription.Builder subcommand(boolean subcommand)
Sets whether this description represents a subcommand.- Parameters:
subcommand- true if this is a subcommand- Returns:
- this builder
-
highlighted
public CommandDescription.Builder highlighted(boolean highlighted)
Sets whether the command should be highlighted.- Parameters:
highlighted- true if highlighted- Returns:
- this builder
-
errorPattern
public CommandDescription.Builder errorPattern(java.util.regex.Pattern errorPattern)
Sets the error pattern.- Parameters:
errorPattern- the error pattern- Returns:
- this builder
-
errorIndex
public CommandDescription.Builder errorIndex(int errorIndex)
Sets the error index.- Parameters:
errorIndex- the error index- Returns:
- this builder
-
build
public CommandDescription build()
Builds the command description.- Returns:
- the immutable command description
-
-