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> List<T> |
getArgumentValues(int index)
Gets the values of an argument with the matching index.
|
<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.
|
default 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.
|
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 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 setgetRawValuesForOption(Option)<T> List<T> getArgumentValues(int index)
T - the expected component typeindex - the indexnull if not setgetArgumentValue(int),
getRawValueForArgument(Argument)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.@Deprecated default List<String> getRawValues(Option option)
getRawValuesForOption(Option)option - the optionList<String> getRawValuesForOption(Option option)
option - the optionList<String> getRawValuesForArgument(Argument argument)
argument - the argumentString 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 optionboolean isValid()
true if the current CommandLine object is valid. false otherwise.boolean isAskingForHelp()
true if the user command line has enabled a "Help" option, false otherwise.Copyright © 2021 Eclipse. All rights reserved.