Skip to content

Commit

Permalink
feat(task): add doc for default task
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Nov 8, 2024
1 parent a0be5fa commit 46cb666
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/getting-started/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,20 @@ function a_very_long_function_name_that_is_very_painful_to_write(): void

> [!TIP]
> Related example: [foo.php](https://github.com/jolicode/castor/blob/main/examples/foo.php)
## Setting a default task

The `Castor\Attribute\AsTask` attribute allows you to set a default task when
calling `castor` without any arguments:

```php
use Castor\Attribute\AsTask;

use function Castor\io;

#[AsTask(name: 'bar', namespace: 'foo', default: true)]
function a_very_long_function_name_that_is_very_painful_to_write(): void
{
io()->writeln('Foo bar');
}
```

0 comments on commit 46cb666

Please sign in to comment.