From e027120266a82dcd7d37ec1d0d14873fa70742fe Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 23 Jan 2016 21:16:13 -0500 Subject: =?UTF-8?q?=F0=9F=92=84=20slight=20refactoring=20&=20adding=20some?= =?UTF-8?q?=20vague=20unit=20tests...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dave Henderson --- context.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 context.go (limited to 'context.go') diff --git a/context.go b/context.go new file mode 100644 index 00000000..939883ea --- /dev/null +++ b/context.go @@ -0,0 +1,20 @@ +package main + +import ( + "os" + "strings" +) + +// Context for templates +type Context struct { +} + +// Env - Map environment variables for use in a template +func (c *Context) Env() map[string]string { + env := make(map[string]string) + for _, i := range os.Environ() { + sep := strings.Index(i, "=") + env[i[0:sep]] = i[sep+1:] + } + return env +} -- cgit v1.2.3