1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

allow assigning variables to tasks at run time via CLI

using a similar syntax than setting env variables to command in bash,
but used right after the task:

```bash
task print MESSAGE=Hello!
```

closes #33
This commit is contained in:
Andrey Nering
2017-09-07 13:57:06 -03:00
parent 5e72de4ba2
commit f3097845b4
8 changed files with 159 additions and 35 deletions

View File

@@ -279,6 +279,15 @@ Example of overriding with environment variables:
$ TASK_VARIABLE=a-value task do-something
```
Since some shells don't support above syntax to set environment variables
(Windows) tasks also accepts a similar style when not in the beginning of
the command. Variables given in this form are only visible to the task called
right before.
```bash
$ task write-file FILE=file.txt "CONTENT=Hello, World!" print "MESSAGE=All done!"
```
Example of locally declared vars:
```yml