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:
parent
d55eb98477
commit
3078a3ee68
12
README.md
12
README.md
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user