Skip to content

Commit 5110172

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: [Console] Add a section for global options
2 parents d7eaa31 + 575e55e commit 5110172

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

console.rst

+11
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,24 @@ the ``list`` command to view all available commands in the application:
2828
cache:clear Clear the cache
2929
...
3030
31+
.. note::
32+
33+
``list`` is the default command, so running ``php bin/console`` is the same.
34+
3135
If you find the command you need, you can run it with the ``--help`` option
3236
to view the command's documentation:
3337

3438
.. code-block:: terminal
3539
3640
$ php bin/console assets:install --help
3741
42+
.. note::
43+
44+
``--help`` is one of the built-in global options from the Console component,
45+
which are available for all commands, including those you can create.
46+
To learn more about them, you can read
47+
:ref:`this section <console-global-options>`.
48+
3849
APP_ENV & APP_DEBUG
3950
~~~~~~~~~~~~~~~~~~~
4051

console/input.rst

+22
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,26 @@ to help you unit test the completion logic::
407407
}
408408
}
409409

410+
.. _console-global-options:
411+
412+
Command Global Options
413+
----------------------
414+
415+
The Console component adds some predefined options to all commands:
416+
417+
* ``--verbose``: sets the verbosity level (e.g. ``1`` the default, ``2`` and
418+
``3``, or you can use respective shortcuts ``-v``, ``-vv`` and ``-vvv``)
419+
* ``--quiet``: disables output and interaction
420+
* ``--no-interaction``: disables interaction
421+
* ``--version``: outputs the version number of the console application
422+
* ``--help``: displays the command help
423+
* ``--ansi|--no-ansi``: whether to force of disable coloring the output
424+
425+
When using the ``FrameworkBundle``, two more options are predefined:
426+
427+
* ``--env``: sets the Kernel configuration environment (defaults to ``APP_ENV``)
428+
* ``--no-debug``: disables Kernel debug (defaults to ``APP_DEBUG``)
429+
430+
So your custom commands can use them too out-of-the-box.
431+
410432
.. _`docopt standard`: http://docopt.org/

0 commit comments

Comments
 (0)