The parser transforms a CLI (a model) into an CommandLine. This CommandLine has stored the argument and option values. Only instance of parser should create objects of this type.
Constructor and description |
---|
CommandLine
(java.lang.Object delegate) |
Type | Name and description |
---|---|
boolean |
acceptMoreValues(java.util.Map<java.lang.String, java.lang.Object> option = [:]) Checks whether or not the given option accept more values. |
java.util.List<java.lang.String> |
allArguments()
|
CLI |
cli()
|
static CommandLine |
create(CLI cli) Creates a command line object from the CLI. |
T |
getArgumentValue(java.lang.String name) Gets the value of an argument with the matching name (arg name). |
T |
getArgumentValue(int index) Gets the value of an argument with the given index. |
java.lang.Object |
getDelegate() |
T |
getOptionValue(java.lang.String name) Gets the value of an option with the matching name (can be the long name, short name or arg name). |
java.lang.String |
getRawValueForArgument(java.util.Map<java.lang.String, java.lang.Object> arg = [:]) Gets the raw value of the given argument. |
java.lang.String |
getRawValueForOption(java.util.Map<java.lang.String, java.lang.Object> option = [:]) Gets the raw value of the given option. |
java.util.List<java.lang.String> |
getRawValues(java.util.Map<java.lang.String, java.lang.Object> option = [:]) Gets the raw values of the given option. |
java.util.List<java.lang.String> |
getRawValuesForArgument(java.util.Map<java.lang.String, java.lang.Object> argument = [:]) Gets the raw values of the given argument. |
java.util.List<java.lang.String> |
getRawValuesForOption(java.util.Map<java.lang.String, java.lang.Object> option = [:]) Gets the raw values of the given option. |
boolean |
isArgumentAssigned(java.util.Map<java.lang.String, java.lang.Object> 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(java.lang.String name) Gets the value of an option marked as a flag. |
boolean |
isOptionAssigned(java.util.Map<java.lang.String, java.lang.Object> option = [:]) Checks whether or not the given option has been assigned in the command line. |
boolean |
isSeenInCommandLine(java.util.Map<java.lang.String, java.lang.Object> 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. all constraints from arguments and options have been satisfied. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Checks whether or not the given option accept more values.
option
- the option (see Option)
Creates a command line object from the CLI. This object is intended to be used by the parser to set the argument and option values.
cli
- the CLI definitionGets the value of an argument with the matching name (arg name).
null
if not setname
- the nameGets the value of an argument with the given index.
null
if not setindex
- the indexGets the value of an option with the matching name (can be the long name, short name or arg name).
null
if not setname
- the nameGets the raw value of the given argument. Raw values are the values as given in the user command line.
null
if none.arg
- the argument (see Argument)Gets the raw value of the given option. Raw values are the values as given in the user command line.
null
if none.option
- the option (see Option)Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
option
- the option (see Option)Gets the raw values of the given argument. Raw values are simple "String", not converted to the argument type.
argument
- the argument (see Argument)Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
option
- the option (see Option)Checks whether or not the given argument has been assigned in the command line.
true
if the argument has received a value, otherwise.arg
- the argument (see Argument)Checks whether or not the user has passed a "help" option and is asking for help.
true
if the user command line has enabled a "Help" option, otherwise.Gets the value of an option marked as a flag.
Calling this method an a non-flag option throws an java.lang.IllegalStateException.true
if the flag has been set in the command line, false
otherwise.name
- the option nameChecks whether or not the given option has been assigned in the command line.
true
if the option has received a value, otherwise.option
- the option (see Option)Checks whether or not the given option has been seen in the user command line.
true
if the user command line has used the optionoption
- the option (see Option)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.
true
if the current CommandLine object is valid. otherwise.