Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion en/console-commands/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,14 @@ 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
========================

Expand Down
8 changes: 6 additions & 2 deletions en/console-commands/input-output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ 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);

// 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');
Expand Down