From a7820fe7d56827adf26f65a6090a32632460b527 Mon Sep 17 00:00:00 2001 From: Mike Pountney Date: Wed, 23 Dec 2015 06:15:31 -0800 Subject: [PATCH] Add a 'join' func to the template engine I needed this so that I can display JIRA labels in my 'list' template. --- util.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util.go b/util.go index fda75f11..4c76c055 100644 --- a/util.go +++ b/util.go @@ -161,6 +161,13 @@ func runTemplate(templateContent string, data interface{}, out io.Writer) error "split": func(sep string, content string) []string { return strings.Split(content, sep) }, + "join": func(sep string, content []interface{}) string { + vals := make([]string, len(content)) + for i, v := range content { + vals[i] = v.(string) + } + return strings.Join(vals, sep) + }, "abbrev": func(max int, content string) string { if len(content) > max { var buffer bytes.Buffer