Package io.vertx.reactivex.core.cli
Class CommandLine
- java.lang.Object
-
- io.vertx.reactivex.core.cli.CommandLine
-
public class CommandLine extends Object
The parser transforms a CLI (a model) into anCommandLine
. ThisCommandLine
has stored the argument and option values. Only instance of parser should create objects of this type. NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<CommandLine>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description CommandLine(CommandLine delegate)
CommandLine(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
acceptMoreValues(Option option)
Checks whether or not the given option accept more values.List<String>
allArguments()
CLI
cli()
static CommandLine
create(CLI cli)
Creates a command line object from theCLI
.boolean
equals(Object o)
<T> T
getArgumentValue(int index)
Gets the value of an argument with the given index.<T> T
getArgumentValue(String name)
Gets the value of an argument with the matching name (arg name).CommandLine
getDelegate()
<T> T
getOptionValue(String name)
Gets the value of an option with the matching name (can be the long name, short name or arg name).String
getRawValueForArgument(Argument arg)
Gets the raw value of the given argument.String
getRawValueForOption(Option option)
Gets the raw value of the given option.List<String>
getRawValues(Option option)
Deprecated.List<String>
getRawValuesForArgument(Argument argument)
Gets the raw values of the given argument.List<String>
getRawValuesForOption(Option option)
Gets the raw values of the given option.int
hashCode()
boolean
isArgumentAssigned(Argument arg)
Checks whether or not the given argument has been assigned in the command line.boolean
isAskingForHelp()
Checks whether or not the user has passed a "help" option and is asking for help.boolean
isFlagEnabled(String name)
Gets the value of an option marked as a flag.boolean
isOptionAssigned(Option option)
Checks whether or not the given option has been assigned in the command line.boolean
isSeenInCommandLine(Option option)
Checks whether or not the given option has been seen in the user command line.boolean
isValid()
Checks whether or not the command line is valid, i.e.static CommandLine
newInstance(CommandLine arg)
String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<CommandLine> __TYPE_ARG
-
-
Constructor Detail
-
CommandLine
public CommandLine(CommandLine delegate)
-
CommandLine
public CommandLine(Object delegate)
-
-
Method Detail
-
getDelegate
public CommandLine getDelegate()
-
create
public static CommandLine create(CLI cli)
Creates a command line object from theCLI
. This object is intended to be used by the parser to set the argument and option values.- Parameters:
cli
- the CLI definition- Returns:
- the command line object
-
cli
public CLI cli()
- Returns:
- the model of this command line object.
-
allArguments
public List<String> allArguments()
- Returns:
- the ordered list of arguments. Arguments are command line arguments not matching an option.
-
getOptionValue
public <T> T getOptionValue(String name)
Gets the value of an option with the matching name (can be the long name, short name or arg name).- Parameters:
name
- the name- Returns:
- the value,
null
if not set
-
getArgumentValue
public <T> T getArgumentValue(String name)
Gets the value of an argument with the matching name (arg name).- Parameters:
name
- the name- Returns:
- the value,
null
if not set
-
getArgumentValue
public <T> T getArgumentValue(int index)
Gets the value of an argument with the given index.- Parameters:
index
- the index- Returns:
- the value,
null
if not set
-
isFlagEnabled
public boolean isFlagEnabled(String name)
Gets the value of an option marked as a flag. Calling this method an a non-flag option throws anIllegalStateException
.- Parameters:
name
- the option name- Returns:
true
if the flag has been set in the command line,false
otherwise.
-
isOptionAssigned
public boolean isOptionAssigned(Option option)
Checks whether or not the given option has been assigned in the command line.- Parameters:
option
- the option- Returns:
true
if the option has received a value, otherwise.
-
getRawValues
@Deprecated public List<String> getRawValues(Option option)
Deprecated.Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.- Parameters:
option
- the option- Returns:
- the list of values, empty if none
-
getRawValuesForOption
public List<String> getRawValuesForOption(Option option)
Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.- Parameters:
option
- the option- Returns:
- the list of values, empty if none
-
getRawValuesForArgument
public List<String> getRawValuesForArgument(Argument argument)
Gets the raw values of the given argument. Raw values are simple "String", not converted to the argument type.- Parameters:
argument
- the argument- Returns:
- the list of values, empty if none
-
getRawValueForOption
public String getRawValueForOption(Option option)
Gets the raw value of the given option. Raw values are the values as given in the user command line.- Parameters:
option
- the option- Returns:
- the value,
null
if none.
-
acceptMoreValues
public boolean acceptMoreValues(Option option)
Checks whether or not the given option accept more values.- Parameters:
option
- the option- Returns:
- if the option accepts more values, otherwise.
-
getRawValueForArgument
public String getRawValueForArgument(Argument arg)
Gets the raw value of the given argument. Raw values are the values as given in the user command line.- Parameters:
arg
- the argument- Returns:
- the value,
null
if none.
-
isArgumentAssigned
public boolean isArgumentAssigned(Argument arg)
Checks whether or not the given argument has been assigned in the command line.- Parameters:
arg
- the argument- Returns:
true
if the argument has received a value, otherwise.
-
isSeenInCommandLine
public boolean isSeenInCommandLine(Option option)
Checks whether or not the given option has been seen in the user command line.- Parameters:
option
- the option- Returns:
true
if the user command line has used the option
-
isValid
public boolean isValid()
Checks whether or not the command line is valid, i.e. all constraints from arguments and options have been satisfied. This method is used when the parser validation is disabled.- Returns:
true
if the currentCommandLine
object is valid. otherwise.
-
isAskingForHelp
public boolean isAskingForHelp()
Checks whether or not the user has passed a "help" option and is asking for help.- Returns:
true
if the user command line has enabled a "Help" option, otherwise.
-
newInstance
public static CommandLine newInstance(CommandLine arg)
-
-