From e1eb3ce74674ae44c63c7f16192b9ca413c72585 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 1 Sep 2025 22:58:21 -0400 Subject: [PATCH 1/3] Improve cross links from commands -> helpers Also add more context to what problems command helpers solve. Refs #8028 --- en/console-commands/commands.rst | 8 +++++++- en/console-commands/input-output.rst | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/en/console-commands/commands.rst b/en/console-commands/commands.rst index 9493a24b5c..5d49818d85 100644 --- a/en/console-commands/commands.rst +++ b/en/console-commands/commands.rst @@ -139,9 +139,15 @@ Creating Output =============== Commands are provided a ``ConsoleIo`` instance when executed. This object allows -you to interact with ``stdout``, ``stderr`` and create files. See the +you to interact with :php:meth:`~Cake\\Console\\ConsoleIo::out()` and +:php:meth:`Cake\\Console\\ConsoleIo::err()` to emit on ``stdout``, and +``stderr``. Files can be created with overwrite confirmation with +:php:meth:`Cake\\Console\\ConsoleIo::createFile()``. :ref:`command-helpers` +provide 'macros' for output generation. See the :doc:`/console-commands/input-output` section for more information. + + Using Models in Commands ======================== diff --git a/en/console-commands/input-output.rst b/en/console-commands/input-output.rst index 3d03c3cd03..72a6b1d544 100644 --- a/en/console-commands/input-output.rst +++ b/en/console-commands/input-output.rst @@ -12,7 +12,10 @@ interactively read user input and output information to the user. Command Helpers =============== -Command Helpers can be accessed and used from any command:: +Formatting console output can be tedious and lead to maintenance issues. To +enable better re-use and testability of console formatting code, CakePHP command +helpers provide 'macros' for console formatting logic. Command Helpers can be +accessed and used from any command:: // Output some data as a table. $io->helper('Table')->output($data); @@ -20,7 +23,8 @@ Command Helpers can be accessed and used from any command:: // Get a helper from a plugin. $io->helper('Plugin.HelperName')->output($data); -You can also get instances of helpers and call any public methods on them:: +You can also get instances of helpers and call any public methods, to manipulate +state and generate updated output:: // Get and use the Progress Helper. $progress = $io->helper('Progress'); From 1d8d8250887d3be93859ee4bc2e95f94c6fe2932 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 1 Sep 2025 23:00:14 -0400 Subject: [PATCH 2/3] Use short links --- en/console-commands/commands.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en/console-commands/commands.rst b/en/console-commands/commands.rst index 5d49818d85..4c55827b13 100644 --- a/en/console-commands/commands.rst +++ b/en/console-commands/commands.rst @@ -140,9 +140,9 @@ Creating Output Commands are provided a ``ConsoleIo`` instance when executed. This object allows you to interact with :php:meth:`~Cake\\Console\\ConsoleIo::out()` and -:php:meth:`Cake\\Console\\ConsoleIo::err()` to emit on ``stdout``, and +:php:meth:`~Cake\\Console\\ConsoleIo::err()` to emit on ``stdout``, and ``stderr``. Files can be created with overwrite confirmation with -:php:meth:`Cake\\Console\\ConsoleIo::createFile()``. :ref:`command-helpers` +:php:meth:`~Cake\\Console\\ConsoleIo::createFile()``. :ref:`command-helpers` provide 'macros' for output generation. See the :doc:`/console-commands/input-output` section for more information. From e26f664b1082ac784edf4954535f8647cf6d9cb5 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 1 Sep 2025 23:00:38 -0400 Subject: [PATCH 3/3] Fix whitespace --- en/console-commands/commands.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/en/console-commands/commands.rst b/en/console-commands/commands.rst index 4c55827b13..a19ace8f23 100644 --- a/en/console-commands/commands.rst +++ b/en/console-commands/commands.rst @@ -147,7 +147,6 @@ provide 'macros' for output generation. See the :doc:`/console-commands/input-output` section for more information. - Using Models in Commands ========================