1
0
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:
Andrey Nering
2021-03-20 11:56:19 -03:00
parent 8994c50d34
commit e6c4706b73
7 changed files with 68 additions and 16 deletions

View File

@ -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