public class CLI extends Object
-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.
NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<CLI> |
__TYPE_ARG |
Modifier and Type | Method and Description |
---|---|
CLI |
addArgument(Argument arg)
Adds an argument.
|
CLI |
addArguments(List<Argument> args)
Adds a set of arguments.
|
CLI |
addOption(Option option)
Adds an option.
|
CLI |
addOptions(List<Option> options)
Adds a set of options.
|
static CLI |
create(String name)
Creates an instance of
CLI using the default implementation. |
boolean |
equals(Object o) |
Argument |
getArgument(int index)
Gets an
Argument based on its index. |
Argument |
getArgument(String name)
Gets an
Argument based on its name (argument name). |
List<Argument> |
getArguments()
Gets the list of defined arguments.
|
CLI |
getDelegate() |
String |
getDescription() |
String |
getName() |
Option |
getOption(String name)
Gets an
Option based on its name (short name, long name or argument name). |
List<Option> |
getOptions()
Gets the list of options.
|
int |
getPriority() |
String |
getSummary() |
int |
hashCode() |
boolean |
isHidden()
Checks whether or not the current
CLI instance is hidden. |
static CLI |
newInstance(CLI arg) |
CommandLine |
parse(List<String> arguments)
Parses the user command line interface and create a new
CommandLine containing extracting values. |
CommandLine |
parse(List<String> arguments,
boolean validate)
Parses the user command line interface and create a new
CommandLine containing extracting values. |
CLI |
removeArgument(int index)
Removes an argument identified by its index.
|
CLI |
removeOption(String name)
Removes an option identified by its name.
|
CLI |
setArguments(List<Argument> args)
Sets the list of arguments.
|
CLI |
setDescription(String desc) |
CLI |
setHidden(boolean hidden)
Sets whether or not the current instance of
CLI must be hidden. |
CLI |
setName(String name)
Sets the name of the CLI.
|
CLI |
setOptions(List<Option> options)
Sets the list of arguments.
|
CLI |
setPriority(int priority)
Sets the priority of the CLI.
|
CLI |
setSummary(String summary)
Sets the summary of the CLI.
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<CLI> __TYPE_ARG
public CLI getDelegate()
public static CLI create(String name)
CLI
using the default implementation.name
- the name of the CLI (must not be null
)CLI
public CommandLine parse(List<String> arguments)
CommandLine
containing extracting values.arguments
- the argumentspublic CommandLine parse(List<String> arguments, boolean validate)
CommandLine
containing extracting values.arguments
- the argumentsvalidate
- enable / disable parsing validationpublic String getName()
public CLI setName(String name)
name
- the nameCLI
instancepublic String getDescription()
public String getSummary()
public CLI setSummary(String summary)
summary
- the summaryCLI
instancepublic boolean isHidden()
CLI
instance is hidden.true
if the current CLI
is hidden, otherwisepublic CLI setHidden(boolean hidden)
CLI
must be hidden. Hidden CLI are not listed when
displaying usages / help messages. In other words, hidden commands are for power user.hidden
- enables or disables the hidden aspect of the CICLI
instancepublic List<Option> getOptions()
public CLI addOption(Option option)
option
- the option, must not be null
.CLI
instancepublic CLI addOptions(List<Option> options)
setOptions(java.util.List<io.vertx.core.cli.Option>)
}, this method does not remove the existing options.
The given list is appended to the existing list.options
- the options, must not be null
CLI
instancepublic CLI setOptions(List<Option> options)
options
- the list of options, must not be null
CLI
instancepublic List<Argument> getArguments()
public CLI addArgument(Argument arg)
arg
- the argument, must not be null
CLI
instancepublic CLI addArguments(List<Argument> args)
setArguments(java.util.List<io.vertx.core.cli.Argument>)
, this method does not remove the existing arguments.
The given list is appended to the existing list.args
- the arguments, must not be null
CLI
instancepublic CLI setArguments(List<Argument> args)
args
- the list of arguments, must not be null
CLI
instancepublic Option getOption(String name)
Option
based on its name (short name, long name or argument name).name
- the name, must not be null
Option
, null
if not foundpublic Argument getArgument(String name)
Argument
based on its name (argument name).name
- the name of the argument, must not be null
Argument
, null
if not found.public Argument getArgument(int index)
Argument
based on its index.index
- the index, must be positive or zero.Argument
, null
if not found.public CLI removeOption(String name)
name
- the option nameCLI
instancepublic CLI removeArgument(int index)
index
- the argument indexCLI
instancepublic int getPriority()
public CLI setPriority(int priority)
priority
- the priorityCLI
instanceCopyright © 2024 Eclipse. All rights reserved.