1
0
mirror of https://github.com/go-task/task.git synced 2025-01-06 03:53:54 +02:00

Added documentation for variables

Closes #2
This commit is contained in:
Sascha Andres 2017-03-02 20:27:26 +01:00
parent eb783d04b8
commit 8619c8d417

View File

@ -39,6 +39,30 @@ task assets build
If Bash is available (Linux and Windows while on Git Bash), the commands will If Bash is available (Linux and Windows while on Git Bash), the commands will
run in Bash, otherwise will fallback to `cmd` (on Windows). run in Bash, otherwise will fallback to `cmd` (on Windows).
### Variables
```yml
build:
deps: [setvar]
cmds:
- echo "{{prefix}} {{THEVAR}}"
variables:
prefix: "Path:"
setvar:
cmds:
- echo "{{PATH}}"
set: THEVAR
```
The above sample saves the path into a new variable which is then again echoed.
You can use environment variables, task level variables and a file called `Variables` as source of variables.
They are evaluated in the following order:
Task local variables are overwritten by variables found in `Variables`. Variables found in `Variables` are overwritten with variables from the environment.
### Task dependencies ### Task dependencies
You may have tasks that depends on others. Just pointing them on `deps` will You may have tasks that depends on others. Just pointing them on `deps` will