From 6bd6690d80931062210d18f3e9855074707b03a8 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 2 May 2020 14:06:02 +0200 Subject: templates: add version func Fixes #316 --- lib/templates/template.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/templates/template.go') diff --git a/lib/templates/template.go b/lib/templates/template.go index e18328cc..d16ac1fd 100644 --- a/lib/templates/template.go +++ b/lib/templates/template.go @@ -16,6 +16,13 @@ import ( "github.com/mitchellh/go-homedir" ) +var version string + +//SetVersion initializes the aerc version displayed in template functions +func SetVersion(v string) { + version = v +} + type TemplateData struct { To []*mail.Address Cc []*mail.Address @@ -168,6 +175,7 @@ var templateFuncs = template.FuncMap{ "dateFormat": time.Time.Format, "toLocal": toLocal, "exec": cmd, + "version": func() string { return version }, } func findTemplate(templateName string, templateDirs []string) (string, error) { -- cgit