CommandLine

The parser transforms a CLI (a model) into an @see \io\vertx\jphp\core\cli\CommandLine. This @see \io\vertx\jphp\core\cli\CommandLine has stored the argument and option values. Only instance of parser should create objects of this type.

package

Default

Methods

__construct

__construct() 

Checks whether or not the given option accept more values.

acceptMoreValues( $arg0) : boolean

Arguments

$arg0

array | Option

Response

boolean

{@link true} if the option accepts more values, {@link false} otherwise.

allArguments

allArguments() : array

Response

array

the ordered list of arguments. Arguments are command line arguments not matching an option.

cli

cli() : \io\vertx\jphp\core\cli\CLI

Response

\io\vertx\jphp\core\cli\CLI

the model of this command line object.

Creates a command line object from the @see \io\vertx\jphp\core\cli\CLI. This object is intended to be used by the parser to set the argument and option values.

create( $arg0) : \io\vertx\jphp\core\cli\CommandLine
static

Arguments

$arg0

CLI

Response

\io\vertx\jphp\core\cli\CommandLine

the command line object

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

getArgumentValue( $arg0) : mixed

param $name [string] the name getArgumentValue($name)

Gets the value of an argument with the given index.

param $index [integer] the index getArgumentValue($index)

Arguments

$arg0

string | integer

Response

mixed

the value, {@code null} if not set

Gets the value of an option with the matching name (can be the long name, short name or arg name).

getOptionValue( $arg0) : mixed

Arguments

$arg0

string

Response

mixed

the value, {@code null} if not set

Gets the raw value of the given argument. Raw values are the values as given in the user command line.

getRawValueForArgument( $arg0) : string

Arguments

$arg0

Argument | array

Response

string

the value, {@code null} if none.

Gets the raw value of the given option. Raw values are the values as given in the user command line.

getRawValueForOption( $arg0) : string

Arguments

$arg0

array | Option

Response

string

the value, {@code null} if none.

Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.

getRawValues( $arg0) : array
deprecated

Arguments

$arg0

array | Option

Response

array

the list of values, empty if none

Gets the raw values of the given argument. Raw values are simple "String", not converted to the argument type.

getRawValuesForArgument( $arg0) : array

Arguments

$arg0

Argument | array

Response

array

the list of values, empty if none

Gets the raw values of the given option. Raw values are simple "String", not converted to the option type.

getRawValuesForOption( $arg0) : array

Arguments

$arg0

array | Option

Response

array

the list of values, empty if none

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

isArgumentAssigned( $arg0) : boolean

Arguments

$arg0

Argument | array

Response

boolean

{@code true} if the argument has received a value, {@link false} otherwise.

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

isAskingForHelp() : boolean

Response

boolean

{@code true} if the user command line has enabled a "Help" option, {@link false} otherwise.

Gets the value of an option marked as a flag.

isFlagEnabled( $arg0) : boolean

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

Arguments

$arg0

string

Response

boolean

{@code true} if the flag has been set in the command line, {@code false} otherwise.

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

isOptionAssigned( $arg0) : boolean

Arguments

$arg0

array | Option

Response

boolean

{@code true} if the option has received a value, {@link false} otherwise.

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

isSeenInCommandLine( $arg0) : boolean

Arguments

$arg0

array | Option

Response

boolean

{@code true} if the user command line has used the option

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.

isValid() : boolean

Response

boolean

{@code true} if the current {@link CommandLine} object is valid. {@link false} otherwise.