Description:
// Whatever the value of `protected $description = '...';` is
Usage:
// Whatever the value of `protected $signature = '...';` is
// (with additional options truncated)
Options:
// Additional Options as defined in `protected $signature = '...';`
// All Default options available to each `php artisan ...` command
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
如果您将命令定义为:
<?php
namespace App\Console\Commands;
class MyCutomCommand extends Command {
protected $signature = 'my-custom-command {--task : Valid Options: A, B, C}';
protected $description = 'This is a Custom Command';
public function handle() {
// Command Logic...
}
}
1条答案
按热度按时间rjee0c151#
--help
命令在对自定义命令运行时,将输出如下内容:如果您将命令定义为:
当你运行
php artisan my-custom-command --help
时,你会看到上面的内容,或者更具体地说:在你的例子中,如果你的有效选项是动态的(或者太长),你可以这样调整你的代码:
文件:
https://laravel.com/docs/10.x/artisan#input-descriptions