Skip to content

Commit

Permalink
doc: add some explaination about the verbose option
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Mar 7, 2024
1 parent 3ae3f8d commit 97963dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/run.php
Expand Up @@ -12,7 +12,7 @@
use function Castor\run;

#[AsTask(description: 'Run a sub-process and display information about it')]
function ls(): void
function ls(bool $verbose = false): void
{
$process = run('ls -alh && echo $foo', quiet: true, environment: ['foo' => 'ba\'"`r']);

Expand Down
4 changes: 4 additions & 0 deletions src/Console/Command/TaskCommand.php
Expand Up @@ -108,6 +108,10 @@ protected function configure(): void
$taskArgumentAttribute->suggestedValues,
);
} elseif ($taskArgumentAttribute instanceof AsOption) {
if ($name === 'verbose') {
throw new FunctionConfigurationException('You cannot re-define a "verbose" option. But you can use "output()->isVerbose()" in your code instead.', $this->function);
}

$mode = $taskArgumentAttribute->mode;
$defaultValue = $parameter->isOptional() ? $parameter->getDefaultValue() : null;

Expand Down

0 comments on commit 97963dd

Please sign in to comment.