Class: CommandLine

vertx-js/command_line~ CommandLine

new CommandLine()

Source:

Methods

acceptMoreValues(option) → {boolean}

Checks whether or not the given option accept more values.
Parameters:
Name Type Description
option Object the option
Source:
Returns:
if the option accepts more values, otherwise.
Type
boolean

allArguments() → {Array.<string>}

Source:
Returns:
the ordered list of arguments. Arguments are command line arguments not matching an option.
Type
Array.<string>

cli() → {CLI}

Source:
Returns:
the model of this command line object.
Type
CLI

getArgumentValue(index) → {Object}

Gets the value of an argument with the given index.
Parameters:
Name Type Description
index number the index
Source:
Returns:
the value, null if not set
Type
Object

getOptionValue(name) → {Object}

Gets the value of an option with the matching name (can be the long name, short name or arg name).
Parameters:
Name Type Description
name string the name
Source:
Returns:
the value, null if not set
Type
Object

getRawValueForArgument(arg) → {string}

Gets the raw value of the given argument. Raw values are the values as given in the user command line.
Parameters:
Name Type Description
arg Object the argument
Source:
Returns:
the value, null if none.
Type
string

getRawValueForOption(option) → {string}

Gets the raw value of the given option. Raw values are the values as given in the user command line.
Parameters:
Name Type Description
option Object the option
Source:
Returns:
the value, null if none.
Type
string

getRawValues(option) → {Array.<string>}

Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
Parameters:
Name Type Description
option Object the option
Source:
Returns:
the list of values, empty if none
Type
Array.<string>

getRawValuesForArgument(argument) → {Array.<string>}

Gets the raw values of the given argument. Raw values are simple "String", not converted to the argument type.
Parameters:
Name Type Description
argument Object the argument
Source:
Returns:
the list of values, empty if none
Type
Array.<string>

getRawValuesForOption(option) → {Array.<string>}

Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.
Parameters:
Name Type Description
option Object the option
Source:
Returns:
the list of values, empty if none
Type
Array.<string>

isArgumentAssigned(arg) → {boolean}

Checks whether or not the given argument has been assigned in the command line.
Parameters:
Name Type Description
arg Object the argument
Source:
Returns:
true if the argument has received a value, otherwise.
Type
boolean

isAskingForHelp() → {boolean}

Checks whether or not the user has passed a "help" option and is asking for help.
Source:
Returns:
true if the user command line has enabled a "Help" option, otherwise.
Type
boolean

isFlagEnabled(name) → {boolean}

Gets the value of an option marked as a flag.

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

Parameters:
Name Type Description
name string the option name
Source:
Returns:
true if the flag has been set in the command line, false otherwise.
Type
boolean

isOptionAssigned(option) → {boolean}

Checks whether or not the given option has been assigned in the command line.
Parameters:
Name Type Description
option Object the option
Source:
Returns:
true if the option has received a value, otherwise.
Type
boolean

isSeenInCommandLine(option) → {boolean}

Checks whether or not the given option has been seen in the user command line.
Parameters:
Name Type Description
option Object the option
Source:
Returns:
true if the user command line has used the option
Type
boolean

isValid() → {boolean}

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.
Source:
Returns:
true if the current CommandLine object is valid. otherwise.
Type
boolean