Interface defining a command-line interface (in other words a command such as 'run', 'ls'.
..). This interface is polyglot to ease reuse such as in Vert.x Shell.
A command line interface has a name, and defines a set of options and arguments. Options are key-value pair such
as -foo=bar
or -flag
. The supported formats depend on the used parser. Arguments are unlike
options raw values. Options are defined using
see |
while argument are defined using @see \io\vertx\jphp\core\cli\Argument. Command line interfaces also define a summary and a description. These attributes are used in the usage generation
. To disable the help generation, set the Command Line Interface object does not contains "value", it's a model. It must be evaluated by a parser that returns a @see \io\vertx\jphp\core\cli\CommandLine object containing the argument and option values. |
---|---|
package |
Default |
__construct()
addArgument( $arg0) : $this
Argument | array
$this
the current {@link CLI} instance
addArguments( $arg0) : $this
The given list is appended to the existing list.
array
$this
the current {@link CLI} instance
addOption( $arg0) : $this
array | Option
$this
the current {@link CLI} instance
addOptions( $arg0) : $this
The given list is appended to the existing list.
array
$this
the current {@link CLI} instance
create( $arg0) : \io\vertx\jphp\core\cli\CLI
getArgument( $arg0) : \io\vertx\jphp\core\cli\Argument
param $name [string] the name of the argument, must not be {@code null} getArgument($name)
Gets an @see \io\vertx\jphp\core\cli\Argument based on its index.
param $index [integer] the index, must be positive or zero. getArgument($index)
string | integer
\io\vertx\jphp\core\cli\Argument
the {@link Argument}, {@code null} if not found.
getArguments() : array
array
the list of argument, empty if none.
getDescription() : string
string
the CLI description.
getName() : string
string
the CLI name.
getOption( $arg0) : \io\vertx\jphp\core\cli\Option
string
\io\vertx\jphp\core\cli\Option
the {@link Option}, {@code null} if not found
getOptions() : array
array
the list of options, empty if none.
getSummary() : string
string
the CLI summary.
isHidden() : boolean
boolean
{@code true} if the current {@link CLI} is hidden, {@link false} otherwise
parse( $arg0, $arg1 = null) : \io\vertx\jphp\core\cli\CommandLine
param $arguments [array] the arguments parse($arguments)
Parses the user command line interface and create a new @see \io\vertx\jphp\core\cli\CommandLine containing extracting values.
param $arguments [array] the arguments param $validate [boolean] enable / disable parsing validation parse($arguments, $validate)
array
boolean
\io\vertx\jphp\core\cli\CommandLine
the creates command line
removeArgument( $arg0) : $this
integer
$this
the current {@link CLI} instance
removeOption( $arg0) : $this
string
$this
the current {@link CLI} instance
setArguments( $arg0) : $this
array
$this
the current {@link CLI} instance
setDescription( $arg0) : $this
string
$this
setHidden( $arg0) : $this
boolean
$this
the current {@link CLI} instance
setName( $arg0) : $this
string
$this
the current {@link CLI} instance
setOptions( $arg0) : $this
array
$this
the current {@link CLI} instance
setSummary( $arg0) : $this
string
$this
the current {@link CLI} instance