public interface CommandLine
CommandLine
. This CommandLine
has stored the argument and option values. Only instance of parser should create
objects of this type.Modifier and Type | Method and 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 the
CLI . |
<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).
|
<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).
|
<T> List<T> |
getOptionValues(String name)
Gets the values 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)
Gets the raw values of the given option.
|
boolean |
isArgumentAssigned(Argument arg)
Checks whether or not the given argument has been assigned in the command line.
|
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)
check whether or not the given option has been seen in the user command line.
|
static CommandLine create(CLI cli)
CLI
. This object is intended to be used by
the parser to set the argument and option values.cli
- the CLI definitionCLI cli()
List<String> allArguments()
<T> T getOptionValue(String name)
T
- the expected typename
- the namenull
if not set<T> T getArgumentValue(String name)
T
- the expected typename
- the namenull
if not set<T> T getArgumentValue(int index)
T
- the expected typeindex
- the indexnull
if not set<T> List<T> getOptionValues(String name)
T
- the expected component typename
- the namenull
if not setgetRawValues(Option)
boolean isFlagEnabled(String name)
IllegalStateException
.name
- the option nametrue
if the flag has been set in the command line, false
otherwise.boolean isOptionAssigned(Option option)
option
- the optiontrue
if the option has received a value, false
otherwise.List<String> getRawValues(Option option)
option
- the optionString getRawValueForOption(Option option)
option
- the optionnull
if none.boolean acceptMoreValues(Option option)
option
- the optiontrue
if the option accepts more values, false
otherwise.String getRawValueForArgument(Argument arg)
arg
- the argumentnull
if none.boolean isArgumentAssigned(Argument arg)
arg
- the argumenttrue
if the argument has received a value, false
otherwise.boolean isSeenInCommandLine(Option option)
option
- the optiontrue
if the user command line has used the optionCopyright © 2015. All rights reserved.