是否有办法显示一个命名空间的所有命令?例如,所有的命令都是教条吗?
这真的很好,因为我有很多命令和很多命令命名空间。
我知道
| grep <namespace>
,但寻找一个内置的symfony选项,如果它存在假设我使用symfony2.0
只输入命名空间的开头,列出可用的命令:
$ php app/console doctrine
[InvalidArgumentException]
Command "doctrine" is not defined.
Did you mean one of these?
doctrine:query:sql
doctrine:query:dql
doctrine:schema:drop
doctrine:mapping:info
[…]
但是如果数字很低,它不会显示所有的命令:
$ php app/console doctrine:cache
[InvalidArgumentException]
Command "doctrine:cache" is ambiguous (doctrine:cache:clear-result, doctrine:cache:clear-query and 1 more).
也可以使用list
命令,它将对命令进行排序并添加描述:
$ php app/console list doctrine
Symfony version 2.3.28 - app/dev/debug
Usage:
command [options] [arguments]
Options:
--help -h Display this help message
[…]
Available commands for the "doctrine" namespace:
doctrine:cache:clear-metadata Clears all metadata cache for an entity manager
doctrine:cache:clear-query Clears all query cache for an entity manager
doctrine:cache:clear-result Clears result cache for an entity manager
doctrine:database:create Creates the configured databases
doctrine:database:drop Drops the configured databases
doctrine:ensure-production-settings Verify that Doctrine is properly configured for a production environment.
[…]
doctrine:schema:create Executes (or dumps) the SQL needed to generate the database schema
doctrine:schema:drop Executes (or dumps) the SQL needed to drop the current database schema
doctrine:schema:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
doctrine:schema:validate Validates the doctrine mapping files
$ php app/console list doctrine:cache
Symfony version 2.3.28 - app/dev/debug
[…]
Available commands for the "doctrine:cache" namespace:
doctrine:cache:clear-metadata Clears all metadata cache for an entity manager
doctrine:cache:clear-query Clears all query cache for an entity manager
doctrine:cache:clear-result Clears result cache for an entity manager