1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

feat: added joinPath and relPath functions

This commit is contained in:
Pete Davison
2023-07-19 21:26:55 +00:00
committed by Andrey Nering
parent d447cc3f19
commit ca72f3c3a1
2 changed files with 33 additions and 7 deletions

View File

@@ -6,9 +6,10 @@ import (
"strings"
"text/template"
sprig "github.com/go-task/slim-sprig"
"mvdan.cc/sh/v3/shell"
"mvdan.cc/sh/v3/syntax"
sprig "github.com/go-task/slim-sprig"
)
var templateFuncs template.FuncMap
@@ -45,6 +46,12 @@ func init() {
},
// IsSH is deprecated.
"IsSH": func() bool { return true },
"joinPath": func(elem ...string) string {
return filepath.Join(elem...)
},
"relPath": func(basePath, targetPath string) (string, error) {
return filepath.Rel(basePath, targetPath)
},
}
// Deprecated aliases for renamed functions.
taskFuncs["FromSlash"] = taskFuncs["fromSlash"]