File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,27 @@ $app->logo('Ascii art logo of your app');
231231$app->handle($_SERVER['argv']); // if argv[1] is `i` or `init` it executes InitCommand
232232```
233233
234+ #### Grouping commands
235+
236+ Grouped commands are listed together in commands list. Explicit grouping a command is optional.
237+ By default if a command name has a colon ` : ` then the part before it is taken as a group,
238+ else ` * ` is taken as a group.
239+
240+ > Example: command name ` app:env ` has a default group ` app ` , command name ` appenv ` has group ` * ` .
241+
242+ ``` php
243+ // Add grouped commands:
244+ $app->group('Configuration', function ($app) {
245+ $app->add(new ConfigSetCommand);
246+ $app->add(new ConfigListCommand);
247+ });
248+
249+ // Alternatively, set group one by one in each commands:
250+ $app->add((new ConfigSetCommand)->inGroup('Config'));
251+ $app->add((new ConfigListCommand)->inGroup('Config'));
252+ ...
253+ ```
254+
234255#### App help
235256
236257It can be triggered manually with ` $app->showHelp() ` or automatic when ` -h ` or ` --help ` option is passed to ` $app->parse() ` .
You can’t perform that action at this time.
0 commit comments