From 80adab38eeb23878ce0e365d6321edaaf677e565 Mon Sep 17 00:00:00 2001 From: Max Jonas Werner Date: Mon, 9 Aug 2021 13:15:32 +0200 Subject: [PATCH] feat: add `defaultColWidth` template function This function can be used in templates to change the default column width to accommodate wider terminals. --- jiracli/templates.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jiracli/templates.go b/jiracli/templates.go index 2d0ae17..ecb72a5 100644 --- a/jiracli/templates.go +++ b/jiracli/templates.go @@ -263,6 +263,10 @@ func RunTemplate(templateName string, data interface{}, out io.Writer) error { headers := []string{} cells := [][]string{} tmpl, err := TemplateProcessor().Funcs(map[string]interface{}{ + "defaultColWidth": func(cw int) string { + table.SetColWidth(cw) + return "" + }, "headers": func(titles ...string) string { headers = append(headers, titles...) return ""