Skip to content

[Console] Add a section for global options #18736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2023
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
11 changes: 11 additions & 0 deletions console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,24 @@ the ``list`` command to view all available commands in the application:
cache:clear Clear the cache
...

.. note::

``list`` is the default command, so running ``php bin/console`` is the same.

If you find the command you need, you can run it with the ``--help`` option
to view the command's documentation:

.. code-block:: terminal

$ php bin/console assets:install --help

.. note::

``--help`` is one of the built-in global options from the Console component,
which are available for all commands, including those you can create.
To learn more about them, you can read
:ref:`this section <console-global-options>`.

APP_ENV & APP_DEBUG
~~~~~~~~~~~~~~~~~~~

Expand Down
22 changes: 22 additions & 0 deletions console/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,26 @@ to help you unit test the completion logic::
}
}

.. _console-global-options:

Command Global Options
----------------------

The Console component adds some predefined options to all commands:

* ``--verbose``: sets the verbosity level (e.g. ``1`` the default, ``2`` and
``3``, or you can use respective shortcuts ``-v``, ``-vv`` and ``-vvv``)
* ``--quiet``: disables output and interaction
* ``--no-interaction``: disables interaction
* ``--version``: outputs the version number of the console application
* ``--help``: displays the command help
* ``--ansi|--no-ansi``: whether to force of disable coloring the output

When using the ``FrameworkBundle``, two more options are predefined:

* ``--env``: sets the Kernel configuration environment (defaults to ``APP_ENV``)
* ``--no-debug``: disables Kernel debug (defaults to ``APP_DEBUG``)

So your custom commands can use them too out-of-the-box.

.. _`docopt standard`: http://docopt.org/