beginSubCommand() public method

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() ... ; }
See also: editSubCommand()
public beginSubCommand ( string $name ) : SubCommandConfig
$name string The name of the sub-command.
return SubCommandConfig The sub-command configuration.
示例#1
0
 public function testBeginSubCommand()
 {
     $this->config->beginSubCommand('command1')->end()->beginSubCommand('command2')->end();
     $this->assertEquals(array(new SubCommandConfig('command1', $this->config, $this->applicationConfig), new SubCommandConfig('command2', $this->config, $this->applicationConfig)), $this->config->getSubCommandConfigs());
 }