Skip to content

Commit

Permalink
add {{env.VARNAME}} template support to allow use of env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Oct 3, 2017
1 parent 172793e commit 4d74554
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jiracli/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ func TemplateProcessor() *template.Template {
"jira": func() string {
return os.Args[0]
},
"env": func() map[string]string {
out := map[string]string{}
for _, env := range os.Environ() {
kv := strings.SplitN(env, "=", 2)
out[kv[0]] = kv[1]
}
return out
},
"toJson": func(content interface{}) (string, error) {
bytes, err := json.MarshalIndent(content, "", " ")
if err != nil {
Expand Down

0 comments on commit 4d74554

Please sign in to comment.