Skip to content

Commit 575e55e

Browse files
committed
minor #18736 [Console] Add a section for global options (HeahDude)
This PR was merged into the 5.4 branch. Discussion ---------- [Console] Add a section for global options Commits ------- 47b30d0 [Console] Add a section for global options
2 parents ae5dd2a + 47b30d0 commit 575e55e

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
@@ -404,4 +404,26 @@ to help you unit test the completion logic::
404404
}
405405
}
406406

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

0 commit comments

Comments
 (0)