1
0
mirror of https://github.com/Luzifer/repo-template.git synced 2024-09-20 01:22:58 +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
}
func simpleReplace(s, old, new string) string {
return strings.Replace(s, old, new, -1)
}
func tplFuncs() template.FuncMap {
return template.FuncMap{
"chkPtrBool": func(i *bool) bool { return i != nil && *i },
"slugify": slug.Make,
"replace": simpleReplace,
}
}