mirror of
https://github.com/go-task/task.git
synced 2025-07-17 01:43:07 +02:00
Add support for delegating CLI arguments with "--" and a special CLI_ARGS variable
Closes #327
This commit is contained in:
@ -520,6 +520,27 @@ tasks:
|
||||
|
||||
This works for all types of variables.
|
||||
|
||||
## Forwarding CLI arguments to commands
|
||||
|
||||
If `--` is given in the CLI, all following paramaters are added to a
|
||||
special `.CLI_ARGS` variable. This is useful to forward arguments to another
|
||||
command.
|
||||
|
||||
The below example will run `yarn install`.
|
||||
|
||||
```bash
|
||||
$ task yarn -- install
|
||||
```
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
yarn:
|
||||
cmds:
|
||||
- yarn {{.CLI_ARGS}}
|
||||
```
|
||||
|
||||
## Go's template engine
|
||||
|
||||
Task parse commands as [Go's template engine][gotemplate] before executing
|
||||
|
Reference in New Issue
Block a user