agence-adeliom/lumberjack-cli


README

这里应该放置您的描述。尽量将其限制在一两段之内,并提及您支持哪些PSR以避免用户和贡献者的混淆。

安装

您可以通过composer安装此包

composer require agence-adeliom/lumberjack-cli

安装完成后,您需要将console文件复制到您的Lumberjack主题目录中。

假设您在Bedrock中使用Lumberjack。如果不是,您可能需要修改console文件中的路径

基本使用

现在您可以从Lumberjack主题目录中访问Adeliom CLI

可用命令

  help                    Displays help for a command
  list                    Lists commands
 make
  make:admin              Create a Admin
  make:ajax               Create a Ajax Action
  make:controller         Create a Controller
  make:cron               Create a Cron Job
  make:env                Create a environement
  make:event              Create a Event Listener
  make:exception          Create a Exception
  make:flex-layout        Create a FlexibleLayout
  make:form               Create a Form
  make:hook               Create a Hooks Class
  make:posttype           Create a PostType
  make:provider           Create a ServiceProvider
  make:taxonomy           Create a Taxonomy
  make:viewmodel          Create a ViewModel
 route
  route:list              List all registered routes

显示可用命令

php console list

运行命令

对于名为test:command的命令,您将运行以下命令:

php console test:command

获取有关命令的额外帮助

对于名为test:command的命令,您将运行以下命令:

php console help test:command

添加命令

要将额外的命令添加到Adeliom CLI,请将它们添加到config/commands.php(如果不存在,请创建文件)。

// config/commands.php

return [
    'commands' => [
        MyCommand::class,
    ],
];

编写命令

创建Adeliom\WP\CLI\Commands\Command的子类

namespace MyNamespace;

use Adeliom\WP\CLI\Commands\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ControllerMake extends Command
{
    protected $signature = 'test:command {paramName : The description of the parameter}';

    protected $description = 'A description of the command';

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        // Command implementation
    }
}

Adeliom CLI使用与Laravel相同的$signature语法,有关更多信息,请参阅此处

Adeliom CLI的Command是Symfony的Command对象的子类,有关如何实现execute()函数的更多信息,请参阅此处

测试

composer test

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

贡献

有关详细信息,请参阅CONTRIBUTING

鸣谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件