Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Add a "template funcs" section to the API reference page #1041

Closed
andreynering opened this issue Mar 7, 2023 · 3 comments
Closed
Assignees
Labels
area: docs Changes related to documentation. good first issue Issues that are good for first-time contributors to pick up.

Comments

@andreynering
Copy link
Member

I just realized the API reference page missed a section mentioning all the additional functions we implement on top of slim-sprig.

We should have a paragraph before the table linking to the slim-sprig documentation: https://go-task.github.io/slim-sprig/.

taskFuncs := template.FuncMap{
"OS": func() string { return runtime.GOOS },
"ARCH": func() string { return runtime.GOARCH },
"catLines": func(s string) string {
s = strings.ReplaceAll(s, "\r\n", " ")
return strings.ReplaceAll(s, "\n", " ")
},
"splitLines": func(s string) []string {
s = strings.ReplaceAll(s, "\r\n", "\n")
return strings.Split(s, "\n")
},
"fromSlash": func(path string) string {
return filepath.FromSlash(path)
},
"toSlash": func(path string) string {
return filepath.ToSlash(path)
},
"exeExt": func() string {
if runtime.GOOS == "windows" {
return ".exe"
}
return ""
},
"shellQuote": func(str string) (string, error) {
return syntax.Quote(str, syntax.LangBash)
},
// IsSH is deprecated.
"IsSH": func() bool { return true },
}

@andreynering andreynering added area: docs Changes related to documentation. good first issue Issues that are good for first-time contributors to pick up. labels Mar 7, 2023
@ayushmaanshrotriya
Copy link

will do

@ayushmaanshrotriya
Copy link

you can assign me this issue

@vmaerten
Copy link
Member

This has been done : #1653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Changes related to documentation. good first issue Issues that are good for first-time contributors to pick up.
Projects
None yet
Development

No branches or pull requests

3 participants