php - Show help text when command encounters error -
i have working command. want add options it. none of these options technically required, at least , at most 1 of them needs supplied single invocation of command. have options set , can detect these circumstances.
however, wish show dialog command whenever check fails. if command my:command, want output of running $ php artisan my:command -h display after error message.
i have tried doing this:
$this->error('my error message'); // causes infinite failness since calling command not passing // options (or ignoring it), hitting same error condition $this->call('my:command', ['-h' => true]); // causes.. nothing. no error, no blank line, see error message artisan::call('help', ['command_name' => 'my:command', 'format' => 'txt']); // both of these cause nothing displayed. from: // symfony\component\console\command\command echo $this->gethelp(); echo $this->getprocessedhelp(); is there way same formatted text of command or trigger message display when error encountered?
update
the default output command when running $ php artisan my:command this:
usage: my:command [options] [--] [<argument>] options: -h, --help display message -q, --quiet not output message -v, --version display application version --ansi force ansi output --no-ansi disable ansi output -n, --no-interaction not ask interactive question --env[=env] environment command should run under. -v|vv|vvv, --verbose increase verbosity of messages: 1 normal output, 2 more verbose output , 3 debug i want output after error message.
to show message after error add after error message line
$this->call('help', ['command_name' => 'test:mycommand', 'format' => 'raw']);
Comments
Post a Comment