1 | <?php |
||
21 | class CommandConfig extends BaseCommandConfig |
||
22 | { |
||
23 | use CommandConfigTrait; |
||
24 | |||
25 | /** |
||
26 | * Starts a configuration block for a sub-command. |
||
27 | * |
||
28 | * A sub-command is executed if the name of the command is passed after the |
||
29 | * name of the containing command. For example, if the command "server" has |
||
30 | * a sub-command command named "add", that command can be called with: |
||
31 | * |
||
32 | * ``` |
||
33 | * $ console server add ... |
||
34 | * ``` |
||
35 | * |
||
36 | * The configuration of the sub-command is returned by this method. You can |
||
37 | * use the fluent interface to configure the sub-command before jumping back |
||
38 | * to this configuration with {@link SubCommandConfig::end()}: |
||
39 | * |
||
40 | * ```php |
||
41 | * protected function configure() |
||
42 | * { |
||
43 | * $this |
||
44 | * ->beginCommand('server') |
||
45 | * ->setDescription('List and manage servers') |
||
46 | * |
||
47 | * ->beginSubCommand('add') |
||
48 | * ->setDescription('Add a server') |
||
49 | * ->addArgument('host', Argument::REQUIRED) |
||
50 | * ->addOption('port', 'p', Option::VALUE_OPTIONAL, null, 80) |
||
51 | * ->end() |
||
52 | * ->end() |
||
53 | * |
||
54 | * // ... |
||
55 | * ; |
||
56 | * } |
||
57 | * ``` |
||
58 | * |
||
59 | * @param string $name The name of the sub-command. |
||
60 | * |
||
61 | * @return SubCommandConfig The sub-command configuration. |
||
62 | * |
||
63 | * @see editSubCommand() |
||
64 | */ |
||
65 | public function beginSubCommand($name) |
||
73 | } |
||
74 |