1
0
Fork 0
mirror of https://github.com/Luzifer/repo-template.git synced 2024-12-23 04:31:20 +00:00

Add replacement function

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-02-07 14:58:37 +01:00
parent ca799e7166
commit 279adc3a6e
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -189,9 +189,14 @@ func getOutfile(repo *github.Repository) (string, error) {
return buf.String(), err return buf.String(), err
} }
func simpleReplace(s, old, new string) string {
return strings.Replace(s, old, new, -1)
}
func tplFuncs() template.FuncMap { func tplFuncs() template.FuncMap {
return template.FuncMap{ return template.FuncMap{
"chkPtrBool": func(i *bool) bool { return i != nil && *i }, "chkPtrBool": func(i *bool) bool { return i != nil && *i },
"slugify": slug.Make, "slugify": slug.Make,
"replace": simpleReplace,
} }
} }