blob: fd6f0240318183dacc567232d24bdfdb3f4c1cee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package printers
import (
"io"
"github.com/olekukonko/tablewriter"
)
// PrintTable writes an terminal-friendly table of the values to the target.
func PrintTable(target io.Writer, headers []string, rows [][]string) {
table := tablewriter.NewWriter(target)
table.SetHeader(headers)
table.SetAutoWrapText(false)
table.SetAutoFormatHeaders(true)
table.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.SetCenterSeparator("")
table.SetColumnSeparator("")
table.SetRowSeparator("")
table.SetHeaderLine(false)
table.SetBorder(false)
table.SetTablePadding("\t")
table.SetNoWhiteSpace(true)
table.AppendBulk(rows)
table.Render()
}
|