mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-09-20 00:02:46 +02:00
Merge pull request #91 from bvieira/#87
Feature: add os.Getenv as template function
This commit is contained in:
commit
952dcec96f
|
@ -3,6 +3,7 @@ package sv
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
@ -35,6 +36,7 @@ func NewOutputFormatter(templatesFS fs.FS) *OutputFormatterImpl {
|
||||||
templateFNs := map[string]interface{}{
|
templateFNs := map[string]interface{}{
|
||||||
"timefmt": timeFormat,
|
"timefmt": timeFormat,
|
||||||
"getsection": getSection,
|
"getsection": getSection,
|
||||||
|
"getenv": os.Getenv,
|
||||||
}
|
}
|
||||||
tpls := template.Must(template.New("templates").Funcs(templateFNs).ParseFS(templatesFS, "*"))
|
tpls := template.Must(template.New("templates").Funcs(templateFNs).ParseFS(templatesFS, "*"))
|
||||||
return &OutputFormatterImpl{templates: tpls}
|
return &OutputFormatterImpl{templates: tpls}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user