MCPcopy Create free account
hub / github.com/go-task/task / init

Function init

internal/templater/funcs.go:24–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22var templateFuncs template.FuncMap
23
24func init() {
25 taskFuncs := template.FuncMap{
26 "OS": goos,
27 "ARCH": goarch,
28 "numCPU": runtime.NumCPU,
29 "catLines": catLines,
30 "splitLines": splitLines,
31 "fromSlash": filepath.FromSlash,
32 "toSlash": filepath.ToSlash,
33 "exeExt": exeExt,
34 "shellQuote": shellQuote,
35 "splitArgs": splitArgs,
36 "IsSH": IsSH, // Deprecated
37 "joinPath": filepath.Join,
38 "joinEnv": joinEnv,
39 "joinUrl": joinUrl,
40 "relPath": filepath.Rel,
41 "absPath": filepath.Abs,
42 "merge": merge,
43 "spew": spew.Sdump,
44 "fromYaml": fromYaml,
45 "mustFromYaml": mustFromYaml,
46 "toYaml": toYaml,
47 "mustToYaml": mustToYaml,
48 "uuid": uuid.New,
49 "randIntN": rand.IntN,
50 }
51
52 // aliases
53 taskFuncs["q"] = taskFuncs["shellQuote"]
54
55 // Deprecated aliases for renamed functions.
56 taskFuncs["FromSlash"] = taskFuncs["fromSlash"]
57 taskFuncs["ToSlash"] = taskFuncs["toSlash"]
58 taskFuncs["ExeExt"] = taskFuncs["exeExt"]
59
60 templateFuncs = template.FuncMap(sprig.TxtFuncMap())
61 maps.Copy(templateFuncs, taskFuncs)
62}
63
64func goos() string {
65 return runtime.GOOS

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…