From 74f2ea51f4498a54f03323365f5e0f1690e1c64e Mon Sep 17 00:00:00 2001 From: Beatriz Vieira Date: Sun, 22 Jan 2023 20:56:22 -0300 Subject: [PATCH] feat: add os.Getenv as template function issue: #87 --- sv/formatter.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sv/formatter.go b/sv/formatter.go index 61b7ee8..3ec1a29 100644 --- a/sv/formatter.go +++ b/sv/formatter.go @@ -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}