diff options
author | Ben Burwell <ben@benburwell.com> | 2019-08-13 15:21:36 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2019-08-13 15:21:36 -0400 |
commit | e4839bdff00f09ccb4e0a8b12d634d26d172dfc9 (patch) | |
tree | ac89ee4d1ce921884825b8cf21560c6d73f59405 | |
parent | 3fa3887c342393b25e2df48f4c096cbf31ce2d5f (diff) |
Add home directory to template vars
-rw-r--r-- | template.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 } |