diff --git a/README.md b/README.md index ca733f16..a7d07281 100644 --- a/README.md +++ b/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 diff --git a/variable_handling.go b/variable_handling.go index b5609dd3..30b38014 100644 --- a/variable_handling.go +++ b/variable_handling.go @@ -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