droath / robo-command-builder
从单个定义文件构建Robo任务命令。
0.0.4
2023-08-11 16:52 UTC
Requires
- consolidation/robo: ^1.0|^2.0|^3.0|^4.0
- symfony/config: ^4.0|^5.0|^6.0
This package is auto-updated.
Last update: 2024-09-11 19:41:56 UTC
README
robo命令构建器是一个工具,允许在定义文件中定义命令。一旦定义了命令,就可以通过PHP方法调用它们。
命令定义允许以下指令
- binary - 字符串(必需)
- commands - 数组(必需)
每个命令操作都可以定义它们的参数和/或选项。`arguments` 定义是一个单键数组。
command.yml
... commands: upload : arguments: - file
您可以在Robo任务类中使用。
<?php $pathToConfig = __DIR__ . '/command.yml'; $task $this->task( CommandBuilder::class, 'upload', $pathToConfig, null ); $task->file(/path/to/file)->run();
`options` 定义可以是单键数组,默认为布尔类型。如果您需要定义更多选项,则需要使用对象数组。选项对象中存在以下参数
- name - 选项名称(必需)
- type - 选项类型(可选 - 默认为布尔型)
- default - 选项默认值(可选)
选项类型
- array
- string
- integer
- boolean
binary: ddev commands: import-db: options: - { "name": "progress" } - { "name": "extract-path" } - { "name": "src", "type": "string" }