kdauzickas/console-alias

快速定义命令别名的助手

v0.1.1 2015-04-03 08:57 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:21:11 UTC


README

这个最小化包允许您快速定义控制台命令,这些命令可以是其他 symfony 控制台命令的别名,也可以是实际的 shell 命令。

安装

  1. 运行 composer require kdauzickas/console-alias
  2. new KD\Console\AliasBundle\KDConsoleAliasBundle() 添加到 $bundles 中,在你的 AppKernel

配置

命令是从您的 config.yml 中定义的。配置应按以下方式完成。只有 namecommand 字段是必需的。

kd_console_alias:
    commands:
        commandName:
            name: "command name that will be used to call the command"
            description: "description to be shown in command list"
            console: "is this a symfony console command alias? Default: false"
            command: "actual command"
            arguments:
                - list of
                - arguments
                - to be passed
                - to the command

示例

kd_console_alias:
    commands:
        pmd:
            name: pmd
            description: Run phpmd
            command: bin/phpmd
            arguments:
                - src
                - text
                - cleancode,codesize,controversial,design,naming,unusedcode

        config:
            name: "c:d"
            description: Alias of the config:debug symfony command
            command: "config:debug"
            console: true

这将允许您运行一个命令 app/console pmd,该命令将执行 bin/phpmd src text cleancode,codesize,controversial,design,naming,unusedcode。命令 app/console c:d 将执行 app/console config:debug