cypresslab / console-defaults-bundle
一个用于向symfony2控制台添加默认参数的包
0.4.0
2013-11-17 20:43 UTC
Requires
- php: >=5.3.3
- symfony/console: ~2.3
- symfony/framework-bundle: ~2.3
Requires (Dev)
- mockery/mockery: @stable
- phpunit/phpunit: ~3.7.28
README
此包允许您为您的命令定义默认参数。它使用控制台事件来工作。因此,您至少需要symfony的2.3 LTS版本
安装
要安装,只需在版本~0.3下require cypresslab/console-defaults-bundle。 在此处阅读完整说明
用法
在cypress_console_defaults键下添加您想要设置的默认参数的命令。以下是一个示例
cypress_console_defaults: commands: "doctrine:fixtures:load": params: [ "--append", "--fixtures src/NS/DataFixtures" ] "rabbitmq:consumer": params: [ "-w" ] "cache:clear": params: [ "--no-warmup", "--no-optional-warmers"]
下次您调用定义的其中一个命令时,该包将为您添加参数
$ ./app/console cache:clear
$ --- ConsoleDefaultsBundle You have defined some defaults for this command
$ --- proceeding with defaults: --no-warmup, --no-optional-warmers
$ Clearing the cache for the dev environment with debug true
从版本0.4开始,您可以将正则表达式作为命令名称传递。您需要将命令用两个斜杠包裹,如下所示
cypress_console_defaults: commands: "/doctrine:(.*)/": params: [ "--no-interaction"]
在此配置下,每个doctrine:...命令都将有"--no-interaction"标志
用例
- 为资产安装默认为--symlink
cypress_console_defaults: commands: "assets:install": params: [ "--symlink" ]
- 更改加载 fixtures 的文件夹
cypress_console_defaults: commands: "doctrine:fixtures:load": params: [ "--fixtures my/personal/folder" ]
- 禁用缓存预热
cypress_console_defaults: commands: "cache:clear": params: [ "--no-warmup", "--no-optional-warmers" ]
还有其他想法吗?