1
0
mirror of https://github.com/go-task/task.git synced 2025-02-13 13:59:32 +02:00

Change "@" for "$" as dynamic var identifier

This commit is contained in:
Andrey Nering 2017-03-08 18:32:32 -03:00
parent d55eb98477
commit 3078a3ee68
2 changed files with 12 additions and 2 deletions

View File

@ -229,7 +229,17 @@ Result: 'abc'
#### Dynamic variables
If you prefix a variable with `@`, then the variable is considered a dynamic variable. The value after the @-synbol will be treated as a command and the output assigned.
If you prefix a variable with `$`, then the variable is considered a dynamic
variable. The value after the $-symbol will be treated as a command and the
output assigned.
```yml
build:
cmds:
- go build -ldflags="-X main.Version={{.LAST_GIT_COMMIT}}" main.go
vars:
LAST_GIT_COMMIT: $git log -n 1 --format=%h
```
### Go's template engine

View File

@ -23,7 +23,7 @@ func handleDynamicVariableContent(value string) (string, error) {
if value == "" {
return value, nil
}
if value[0] != '@' {
if value[0] != '$' {
return value, nil
}
var cmd *exec.Cmd