summaryrefslogtreecommitdiff
path: root/lib/templates
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-05-02 14:06:02 +0200
committerDrew DeVault <sir@cmpwn.com>2020-05-06 10:00:59 -0400
commit6bd6690d80931062210d18f3e9855074707b03a8 (patch)
treef1d0460cb11a51037bda61f170ffad1c60b5a5f4 /lib/templates
parent434eaa19a18a1f4c49796118e3c601317374474e (diff)
downloadaerc-6bd6690d80931062210d18f3e9855074707b03a8.zip
templates: add version func
Fixes #316
Diffstat (limited to 'lib/templates')
-rw-r--r--lib/templates/template.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/templates/template.go b/lib/templates/template.go
index e18328c..d16ac1f 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) {