0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-09-20 00:02:46 +02:00

feat: add os.Getenv as template function

issue: #87
This commit is contained in:
Beatriz Vieira 2023-01-22 20:56:22 -03:00
parent 4fec01e9b5
commit 74f2ea51f4

View File

@ -3,6 +3,7 @@ package sv
import (
"bytes"
"io/fs"
"os"
"sort"
"text/template"
"time"
@ -35,6 +36,7 @@ func NewOutputFormatter(templatesFS fs.FS) *OutputFormatterImpl {
templateFNs := map[string]interface{}{
"timefmt": timeFormat,
"getsection": getSection,
"getenv": os.Getenv,
}
tpls := template.Must(template.New("templates").Funcs(templateFNs).ParseFS(templatesFS, "*"))
return &OutputFormatterImpl{templates: tpls}