zunderbolt/cakephp-shell-autohelp

自动生成 CakePHP3 控制台外壳帮助

安装: 137

依赖: 0

建议者: 0

安全: 0

星级: 0

关注者: 1

分支: 0

开放问题: 0

类型:cakephp-plugin

dev-master 2017-03-28 11:43 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:32:06 UTC


README

一个小的特性,用于自动生成 CakePHP3 控制台外壳帮助。无需编写 $parser->addArgument() 等内容,只需在您的外壳方法中添加 phpdoc。

安装

composer require zunderbolt/cakephp-shell-autohelp

用法

namespace App\Shell;

use Cake\Console\Shell;
use ZunderBolt\ShellAutoHelp\AutoHelpTrait;

class MyShell extends Shell
{
    use AutoHelpTrait;

    /**
     * Method description will be used in help
     * @param string $param1 Param1 description
     * @param mixed $param2 Param2 description
     */
    public function test($param1, $param2 = null)
    {
    }
}

> bin/cake my

Usage:
cake my [subcommand] [-h] [-q] [-v]

Subcommands:

test  Method description will be used in help

> bin/cake my test --help

Usage:
cake my test [-h] [-q] [-v] <param1> [<param2>]

Options:

--help, -h     Display this help.
--quiet, -q    Enable quiet output.
--verbose, -v  Enable verbose output.

Arguments:

param1  (string) Param1 description
param2  (mixed) Param2 description (optional)