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.

no subtypes hierarchy

Initializer
CommandLine(CommandLine unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
acceptMoreValuesshared default Boolean acceptMoreValues(Option option)

Checks whether or not the given option accept more values.

Parameters:
  • option

    the option

allArgumentsshared default List<String> allArguments()
clishared default CLI cli()
getArgumentValueshared default T? getArgumentValue<T>(Integer index)

Gets the value of an argument with the given index.

Parameters:
  • index

    the index

getArgumentValueshared default T? getArgumentValue<T>(String name)

Gets the value of an argument with the matching name (arg name).

Parameters:
  • name

    the name

getOptionValueshared default T? getOptionValue<T>(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

getRawValueForArgumentshared default 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

getRawValueForOptionshared default 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

getRawValuesshared default List<String> getRawValues(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

getRawValuesForArgumentshared default 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

getRawValuesForOptionshared default 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

isArgumentAssignedshared default Boolean isArgumentAssigned(Argument arg)

Checks whether or not the given argument has been assigned in the command line.

Parameters:
  • arg

    the argument

isAskingForHelpshared default Boolean isAskingForHelp()

Checks whether or not the user has passed a “help” option and is asking for help.

isFlagEnabledshared default Boolean isFlagEnabled(String name)

Gets the value of an option marked as a flag.

Calling this method an a non-flag option throws an java.lang.IllegalStateException.

Parameters:
  • name

    the option name

isOptionAssignedshared default Boolean isOptionAssigned(Option option)

Checks whether or not the given option has been assigned in the command line.

Parameters:
  • option

    the option

isSeenInCommandLineshared default Boolean isSeenInCommandLine(Option option)

Checks whether or not the given option has been seen in the user command line.

Parameters:
  • option

    the option

isValidshared default 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.

Inherited Methods
Methods inherited from: Object
equals