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:
parent
ca799e7166
commit
279adc3a6e
5
main.go
5
main.go
@ -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,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user