An option command is executed if the corresponding option is passed after
the command name. For example, if the command "server" has an option
command named "--add" with the short name "-a", that command can be
called with:
$ console server --add ...
$ console server -a ...
The configuration of the option command is returned by this method.
You can use the fluent interface to configure the option command
before jumping back to this configuration with
{@link SubCommandConfig::end()}:
php
protected function configure()
{
$this
->beginCommand('server')
->setDescription('List and manage servers')
->beginOptionCommand('add', 'a')
->setDescription('Add a server')
->addArgument('host', Argument::REQUIRED)
->addOption('port', 'p', Option::VALUE_OPTIONAL, null, 80)
->end()
->end()
...
;
}
public beginOptionCommand ( string $name, string $shortName = null ) : |
||
$name | string | The name of the option command. |
$shortName | string | The short name of the option command. |
리턴 | The option command configuration. |