@@ -147,13 +147,17 @@ If you can't use PHP attributes, register the command as a service and
147147:ref: `default services.yaml configuration <service-container-services-load-example >`,
148148this is already done for you, thanks to :ref: `autoconfiguration <services-autoconfigure >`.
149149
150- You can also use ``#[AsCommand] `` to add a description, usages, and longer help text for the command::
150+ You can also use ``#[AsCommand] `` to add a description, usage exampless, and
151+ longer help text for the command::
151152
152153 #[AsCommand(
153154 name: 'app:create-user',
154- description: 'Creates a new user.', // the command description shown when running "php bin/console list"
155- help: 'This command allows you to create a user...', // the command help shown when running the command with the "--help" option
156- usages: ['app:create-user alice'],
155+ // this short description is shown when running "php bin/console list"
156+ description: 'Creates a new user.',
157+ // this is shown when running the command with the "--help" option
158+ help: 'This command allows you to create a user...',
159+ // this allows you to show one or more usage examples (no need to add the command name)
160+ usages: ['bob', 'alice --as-admin'],
157161 )]
158162 class CreateUserCommand
159163 {
@@ -165,7 +169,8 @@ You can also use ``#[AsCommand]`` to add a description, usages, and longer help
165169
166170.. versionadded :: 7.4
167171
168- The ability to add usages via a ``$usages `` property was introduced in Symfony 7.4.
172+ The feature to define usage examples in the ``#[AsCommand] `` attribute was
173+ introduced in Symfony 7.4.
169174
170175Additionally, you can extend the :class: `Symfony\\ Component\\ Console\\ Command\\ Command ` class to
171176leverage advanced features like lifecycle hooks (e.g. :method: `Symfony\\ Component\\ Console\\ Command\\ Command::initialize ` and
0 commit comments