about summary refs log tree commit diff stats
path: root/lib/templates
diff options
context:
space:
mode:
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) {