CommandLine.
This implementation is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| protected List | |
| protected Map | |
| protected final CLI | |
| protected List | |
| protected Map | |
| protected boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | acceptMoreValues(Option
the option option)Implements io. Checks whether or not the given option accept more values. |
| public CommandLine | Returns: the current instance ofDefaultCommandLine.the argument argument)Adds an argument value. |
| public DefaultCommandLine | |
| public List | Returns: the ordered list of not recognized arguments. Unrecognized arguments are command line arguments matching neither known options or defined arguments.Implements io.
|
| public CLI | |
| public static <T> T | Returns: the created valuethe value value, TypedArgument<T> argument)Creates the value for the given argument from the given raw value. |
| public static <T> T | Returns: the created valuethe value value, TypedOption<T> option)Creates the value for the given option from the given raw value. |
| public static <T> List | |
| public <T> T | getArgumentValue(String
the name name)Implements io. Gets the value of an argument with the matching name (arg name). |
| public <T> T | getArgumentValue(int
the index index)Implements io. Gets the value of an argument with the given index. |
| public <T> List | Returns: the values,null if not setthe index index)Implements io. Gets the values of an argument with the matching index. |
| public <T> T | getOptionValue(String
the name name)Implements io. Gets the value of an option with the matching name (can be the long name, short name or arg name). |
| public <T> List | getOptionValues(String
the name name)Implements io. Gets the values of an option with the matching name (can be the long name, short name or arg name). |
| public String | getRawValueForArgument(Argument
the argument arg)Implements io. Gets the raw value of the given argument. |
| public String | getRawValueForOption(Option
the option option)Implements io. Gets the raw value of the given option. |
| public List | getRawValuesForArgument(Argument
the argument argument)Implements io. Gets the raw values of the given argument. |
| public List | getRawValuesForOption(Option
the option option)Implements io. Gets the raw values of the given option. |
| private <T> T | |
| public boolean | isArgumentAssigned(Argument
the argument arg)Implements io. Checks whether or not the given argument has been assigned in the command line. |
| public boolean | isAskingForHelp()
Implements io. Checks whether or not the user has passed a "help" option and is asking for help. |
| private boolean | |
| public boolean | isFlagEnabled(String
the option name name)Implements io. Gets the value of an option marked as a flag. |
| public boolean | isOptionAssigned(Option
the option option)Implements io. Checks whether or not the given option has been assigned in the command line. |
| public boolean | isSeenInCommandLine(Option
the option option)Implements io. Checks whether or not the given option has been seen in the user command line. |
| public boolean | isValid()
Implements io. Checks whether or not the command line is valid, i.e. all constraints from arguments and options have been satisfied. |
| public DefaultCommandLine | |
| public DefaultCommandLine | Returns: the current instance ofDefaultCommandLine.the option option)Marks the option as seen. |
| pack-priv void | setValidity(boolean
true if the command line is valid.Sets whether or not the |
| allArgs | back to summary |
|---|---|
| protected List<String> allArgs | |
| argumentValues | back to summary |
|---|---|
| protected Map<Argument, List<String>> argumentValues | |
| cli | back to summary |
|---|---|
| protected final CLI cli | |
| optionsSeenInCommandLine | back to summary |
|---|---|
| protected List<Option> optionsSeenInCommandLine | |
| optionValues | back to summary |
|---|---|
| protected Map<Option, List<String>> optionValues | |
| valid | back to summary |
|---|---|
| protected boolean valid | |
| DefaultCommandLine | back to summary |
|---|---|
| public DefaultCommandLine(CLI cli) | |
| acceptMoreValues | back to summary |
|---|---|
| public boolean acceptMoreValues(Option option) Implements io. Doc from io. Checks whether or not the given option accept more values. | |
| addArgumentValue | back to summary |
|---|---|
| public CommandLine addArgumentValue(String argument) Adds an argument value.
| |
| addRawValue | back to summary |
|---|---|
| public DefaultCommandLine addRawValue(Option option, String value) | |
| allArguments | back to summary |
|---|---|
| public List Implements io. | |
| cli | back to summary |
|---|---|
| public CLI cli() Implements io. | |
| create | back to summary |
|---|---|
| public static <T> T create(String value, TypedArgument<T> argument) Creates the value for the given argument from the given raw value.
| |
| create | back to summary |
|---|---|
| public static <T> T create(String value, TypedOption<T> option) Creates the value for the given option from the given raw value.
| |
| createFromList | back to summary |
|---|---|
| public static <T> List | |
| getArgumentValue | back to summary |
|---|---|
| public <T> T getArgumentValue(String name) Implements io. Doc from io. Gets the value of an argument with the matching name (arg name). | |
| getArgumentValue | back to summary |
|---|---|
| public <T> T getArgumentValue(int index) Implements io. Doc from io. Gets the value of an argument with the given index.
| |
| getArgumentValues | back to summary |
|---|---|
| public <T> List Implements io. Gets the values of an argument with the matching index.
| |
| getOptionValue | back to summary |
|---|---|
| public <T> T getOptionValue(String name) Implements io. Doc from io. Gets the value of an option with the matching name (can be the long name, short name or arg name).
| |
| getOptionValues | back to summary |
|---|---|
| public <T> List Implements io. Doc from io. Gets the values of an option with the matching name (can be the long name, short name or arg name).
| |
| getRawValueForArgument | back to summary |
|---|---|
| public String getRawValueForArgument(Argument arg) Implements io. Doc from io. Gets the raw value of the given argument. Raw values are the values as given in the user command line. | |
| getRawValueForOption | back to summary |
|---|---|
| public String getRawValueForOption(Option option) Implements io. Doc from io. Gets the raw value of the given option. Raw values are the values as given in the user command line. | |
| getRawValuesForArgument | back to summary |
|---|---|
| public List Implements io. Doc from io. Gets the raw values of the given argument. Raw values are simple "String", not converted to the argument type. | |
| getRawValuesForOption | back to summary |
|---|---|
| public List Implements io. Doc from io. Gets the raw values of the given option. Raw values are simple "String", not converted to the option type. | |
| getValue | back to summary |
|---|---|
| private <T> T getValue(TypedOption<T> option) | |
| isArgumentAssigned | back to summary |
|---|---|
| public boolean isArgumentAssigned(Argument arg) Implements io. Doc from io. Checks whether or not the given argument has been assigned in the command line. | |
| isAskingForHelp | back to summary |
|---|---|
| public boolean isAskingForHelp() Implements io. Checks whether or not the user has passed a "help" option and is asking for help. | |
| isBoolean | back to summary |
|---|---|
| private boolean isBoolean(TypedOption<T> option) | |
| isFlagEnabled | back to summary |
|---|---|
| public boolean isFlagEnabled(String name) Implements io. Doc from io. Gets the value of an option marked as a flag.
Calling this method an a non-flag option throws an | |
| isOptionAssigned | back to summary |
|---|---|
| public boolean isOptionAssigned(Option option) Implements io. Doc from io. Checks whether or not the given option has been assigned in the command line. | |
| isSeenInCommandLine | back to summary |
|---|---|
| public boolean isSeenInCommandLine(Option option) Implements io. Doc from io. Checks whether or not the given option has been seen in the user command line. | |
| isValid | back to summary |
|---|---|
| public boolean isValid() Implements io. 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.
| |
| setRawValue | back to summary |
|---|---|
| public DefaultCommandLine setRawValue(Argument arg, String rawValue) | |
| setSeenInCommandLine | back to summary |
|---|---|
| public DefaultCommandLine setSeenInCommandLine(Option option) Marks the option as seen.
| |
| setValidity | back to summary |
|---|---|
| pack-priv void setValidity(boolean validity) Sets whether or not the
| |