(tmpl *template.Template, subContext SubContext)
| 91 | } |
| 92 | |
| 93 | func (c *Context) postFormat(tmpl *template.Template, subContext SubContext) { |
| 94 | out := c.Output |
| 95 | if out == nil { |
| 96 | out = io.Discard |
| 97 | } |
| 98 | if !c.Format.IsTable() { |
| 99 | _, _ = c.buffer.WriteTo(out) |
| 100 | return |
| 101 | } |
| 102 | |
| 103 | // Write column-headers and rows to the tab-writer buffer, then flush the output. |
| 104 | tw := tabwriter.NewWriter(out, 10, 1, 3, ' ', 0) |
| 105 | _ = tmpl.Funcs(templates.HeaderFunctions).Execute(tw, subContext.FullHeader()) |
| 106 | _, _ = tw.Write([]byte{'\n'}) |
| 107 | _, _ = c.buffer.WriteTo(tw) |
| 108 | _ = tw.Flush() |
| 109 | } |
| 110 | |
| 111 | func (c *Context) contextFormat(tmpl *template.Template, subContext SubContext) error { |
| 112 | if err := tmpl.Execute(c.buffer, subContext); err != nil { |
no test coverage detected