Interface defining a command-line interface (in other words a command such as 'run', 'ls'…). This interface is polyglot to ease reuse such as in Vert.x Shell.
A command line interface has a name, and defines a set of options and arguments. Options are key-value pair such as-foo=bar
or -flag
. The supported formats depend on the used parser. Arguments are unlike
options raw values. Options are defined using
Option, while argument are defined using Argument.
Command line interfaces also define a summary and a description. These attributes are used in the usage generation
. To disable the help generation, set the hidden
attribute to true
.
Command Line Interface object does not contains “value”, it's a model. It must be evaluated by a
parser that returns a CommandLine object containing the argument and option values.
Anything
Object
CLI
Basic
Identifiable
Object
Anything
no subtypes hierarchy
Initializer |
CLI(CLI unknown) |
Inherited Attributes |
Attributes inherited from: Object hash , string |
Methods | |
addArgument | shared default CLI addArgument(Argument arg) Adds an argument. Parameters:
|
addArguments | shared default CLI addArguments(List<Argument> args) Adds a set of arguments. Unlike setArguments, this method does not remove the existing arguments. The given list is appended to the existing list. Parameters:
|
addOption | shared default CLI addOption(Option option) Adds an option. Parameters:
|
addOptions | shared default CLI addOptions(List<Option> options) Adds a set of options. Unlike setOptions}, this method does not remove the existing options. The given list is appended to the existing list. Parameters:
|
getArgument | shared default Argument? getArgument(Integer index) Gets an Argument based on its index. Parameters:
|
getArgument | shared default Argument? getArgument(String name) Gets an Argument based on its name (argument name). Parameters:
|
getArguments | shared default List<Argument> getArguments() Gets the list of defined arguments. |
getDescription | shared default String? getDescription() @return the CLI description. |
getName | shared default String getName() @return the CLI name. |
getOption | shared default Option? getOption(String name) Gets an Option based on its name (short name, long name or argument name). Parameters:
|
getOptions | shared default List<Option> getOptions() Gets the list of options. |
getSummary | shared default String? getSummary() @return the CLI summary. |
isHidden | shared default Boolean isHidden() Checks whether or not the current CLI instance is hidden. |
parse | shared default CommandLine parse(List<String> arguments) Parses the user command line interface and create a new CommandLine containing extracting values. Parameters:
|
parse | shared default CommandLine parse(List<String> arguments, Boolean validate) Parses the user command line interface and create a new CommandLine containing extracting values. Parameters:
|
removeArgument | shared default CLI removeArgument(Integer index) Removes an argument identified by its index. This method does nothing if the argument cannot be found. Parameters:
|
removeOption | shared default CLI removeOption(String name) Removes an option identified by its name. This method does nothing if the option cannot be found. Parameters:
|
setArguments | shared default CLI setArguments(List<Argument> args) Sets the list of arguments. Parameters:
|
setDescription | shared default CLI setDescription(String desc) |
setHidden | shared default CLI setHidden(Boolean hidden) Sets whether or not the current instance of CLI must be hidden. Hidden CLI are not listed when displaying usages / help messages. In other words, hidden commands are for power user. Parameters:
|
setName | shared default CLI setName(String name) Sets the name of the CLI. Parameters:
|
setOptions | shared default CLI setOptions(List<Option> options) Sets the list of arguments. Parameters:
|
setSummary | shared default CLI setSummary(String summary) Sets the summary of the CLI. Parameters:
|
Inherited Methods |
Methods inherited from: Object equals |