package ui import ( "fmt" "github.com/fatih/color" "github.com/gosuri/uitable" ) func Error(s string) { color.Red(s) } type KV struct { K string V string } func KVTable(kvs []KV) { table := uitable.New() table.MaxColWidth = 100 table.Wrap = true // wrap columns table.AddRow("") for _, i := range kvs { if i.V == "" { table.AddRow(i.K, "-") } else { table.AddRow(i.K, i.V) } } fmt.Println(table) }