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