From e4839bdff00f09ccb4e0a8b12d634d26d172dfc9 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 13 Aug 2019 15:21:36 -0400 Subject: Add home directory to template vars --- template.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/template.go b/template.go index 31d4358..7e933bb 100644 --- a/template.go +++ b/template.go @@ -16,6 +16,7 @@ type TemplateData struct { OS string Arch string Hostname string + Home string Vars map[string]interface{} } @@ -54,6 +55,11 @@ func getTemplateData() (*TemplateData, error) { } else { data.Hostname = host } + if home, err := os.UserHomeDir(); err != nil { + return nil, err + } else { + data.Home = home + } return data, nil } -- cgit v1.2.3