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:
parent
ca799e7166
commit
279adc3a6e
1 changed files with 5 additions and 0 deletions
5
main.go
5
main.go
|
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue