ensure sprig funcs are mapped for files

This commit is contained in:
Diego Fernando Carrión 2023-10-13 16:14:53 +02:00
parent 06da4ca080
commit 81fdd9a413
Signed by: CRThaze
GPG Key ID: 0F647F8A6A3AF588

View File

@ -266,13 +266,13 @@ func main() {
tplFiles := expandFiles(flag.Args())
// Otherwise use the provided tplFiles/directories for templates to render.
// fmt.Fprintf(os.Stderr, "%+v\n", tplFiles)
tpl, err = template.ParseFiles(tplFiles...)
tpl, err = tpl.ParseFiles(tplFiles...)
checkErr(err)
for i, file := range tplFiles {
if i > 0 {
fmt.Println(flags.outputDelimiter)
}
checkErr(tpl.ExecuteTemplate(os.Stdout, filepath.Base(file), values))
checkErr(tpl.Funcs(sprig.FuncMap()).ExecuteTemplate(os.Stdout, filepath.Base(file), values))
}
return
}