diff --git a/console.rst b/console.rst index 0ec6f28b02a..0aeece2dc09 100644 --- a/console.rst +++ b/console.rst @@ -206,6 +206,8 @@ After configuring and registering the command, you can run it in the terminal: As you might expect, this command will do nothing as you didn't write any logic yet. Add your own logic inside the ``__invoke()`` method. +.. _command-aliases: + Command Aliases ~~~~~~~~~~~~~~~ diff --git a/console/hide_commands.rst b/console/hide_commands.rst index 17bcf37a8f9..aad4b6d45a4 100644 --- a/console/hide_commands.rst +++ b/console/hide_commands.rst @@ -22,8 +22,9 @@ the ``hidden`` property of the ``AsCommand`` attribute:: // ... } -You can also define a command as hidden using the pipe (``|``) syntax in the -command name:: +You can also define a command as hidden using the pipe (``|``) syntax of +:ref:`command aliases `. To do this, use the command name as one +of the aliases and leave the main command name (the part before the ``|``) empty:: // src/Command/LegacyCommand.php namespace App\Command; @@ -39,11 +40,7 @@ command name:: .. versionadded:: 7.4 - The ability to define a command as hidden using the pipe syntax in the - command name was introduced in Symfony 7.4. - -Hidden commands behave the same as normal commands but they are no longer -displayed in command listings, so end-users are not aware of their existence. + Support for hidding commands using the pipe syntax was introduced in Symfony 7.4. .. note::