mirror of
https://github.com/go-task/task.git
synced 2025-06-25 00:47:04 +02:00
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/go-task/task/execext"
|
"github.com/go-task/task/execext"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
"github.com/Masterminds/sprig"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -76,10 +77,19 @@ func (t *Task) handleVariables() (map[string]string, error) {
|
|||||||
return localVariables, nil
|
return localVariables, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var templateFuncs = template.FuncMap{
|
var templateFuncs template.FuncMap
|
||||||
"OS": func() string { return runtime.GOOS },
|
|
||||||
"ARCH": func() string { return runtime.GOARCH },
|
func init() {
|
||||||
"IsSH": func() bool { return execext.ShExists },
|
taskFuncs := template.FuncMap{
|
||||||
|
"OS": func() string { return runtime.GOOS },
|
||||||
|
"ARCH": func() string { return runtime.GOARCH },
|
||||||
|
"IsSH": func() bool { return execext.ShExists },
|
||||||
|
}
|
||||||
|
|
||||||
|
templateFuncs = sprig.TxtFuncMap()
|
||||||
|
for k, v := range taskFuncs {
|
||||||
|
templateFuncs[k] = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplaceVariables writes vars into initial string
|
// ReplaceVariables writes vars into initial string
|
||||||
|
Reference in New Issue
Block a user