Skip to content

Commit 8135712

Browse files
committed
Remove docs for subcommands
- Remove subcommand references from docs. - Add to the 5.0 migration guide as subcommands were not explicitly mentioned there previously. Fixes #7825
1 parent 2dcfec6 commit 8135712

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

en/appendices/5-0-migration-guide.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Console
6868
- ``BaseCommand::__construct()`` was removed.
6969
- ``ConsoleIntegrationTestTrait::useCommandRunner()`` was removed since it's no longer needed.
7070
- ``Shell`` has been removed and should be replaced with `Command <https://book.cakephp.org/5/en/console-commands/commands.html>`__
71+
- ``ConsoleOptionParser::addSubcommand()`` was removed alongside the removal of
72+
``Shell``. Subcommands should be replaced with ``Command`` classes that
73+
implement ``Command::defaultName()`` to define the necessary command name.
7174
- ``BaseCommand`` now emits ``Command.beforeExecute`` and
7275
``Command.afterExecute`` events around the command's ``execute()`` method
7376
being invoked by the framework.

en/console-commands/commands.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ Update the command class to the following::
482482
}
483483
}
484484

485-
Now that we have an interactive subcommand, we can add a test case that tests
485+
Now that we have an interactive command, we can add a test case that tests
486486
that we receive the proper response, and one that tests that we receive an
487487
incorrect response. Remove the ``testUpdateModified`` method and, add the following methods to
488488
**tests/TestCase/Command/UpdateTableCommandTest.php**::

en/console-commands/option-parsers.rst

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -194,32 +194,12 @@ Building a ConsoleOptionParser from an Array
194194

195195
.. php:method:: buildFromArray($spec)
196196
197-
As previously mentioned, when creating subcommand option parsers, you can define
198-
the parser spec as an array for that method. This can help make building
199-
subcommand parsers easier, as everything is an array::
200-
201-
$parser->addSubcommand('check', [
202-
'help' => __('Check the permissions between an ACO and ARO.'),
203-
'parser' => [
204-
'description' => [
205-
__("Use this command to grant ACL permissions. Once executed, the "),
206-
__("ARO specified (and its children, if any) will have ALLOW access "),
207-
__("to the specified ACO action (and the ACO's children, if any)."),
208-
],
209-
'arguments' => [
210-
'aro' => ['help' => __('ARO to check.'), 'required' => true],
211-
'aco' => ['help' => __('ACO to check.'), 'required' => true],
212-
'action' => ['help' => __('Action to check')],
213-
],
214-
],
215-
]);
216-
217-
Inside the parser spec, you can define keys for ``arguments``, ``options``,
218-
``description`` and ``epilog``. You cannot define ``subcommands`` inside an
219-
array style builder. The values for arguments, and options, should follow the
220-
format that :php:func:`Cake\\Console\\ConsoleOptionParser::addArguments()` and
197+
Option parsers can also be defined as arrays. Within the array, you can define
198+
keys for ``arguments``, ``options``, ``description`` and ``epilog``. The values
199+
for arguments, and options, should follow the format that
200+
:php:func:`Cake\\Console\\ConsoleOptionParser::addArguments()` and
221201
:php:func:`Cake\\Console\\ConsoleOptionParser::addOptions()` use. You can also
222-
use buildFromArray on its own, to build an option parser::
202+
use ``buildFromArray`` on its own, to build an option parser::
223203

224204
public function getOptionParser()
225205
{
@@ -287,8 +267,8 @@ returned as XML:
287267
cake bake --help xml
288268
cake bake -h xml
289269
290-
The above would return an XML document with the generated help, options,
291-
arguments and subcommands for the selected shell. A sample XML document would
270+
The above would return an XML document with the generated help, options, and
271+
arguments for the selected shell. A sample XML document would
292272
look like:
293273

294274
.. code-block:: xml

0 commit comments

Comments
 (0)