package ui import ( "fmt" "os" "github.com/fatih/color" "github.com/gosuri/uitable" ) const THEMECOLOR = "#f76945" func Error(s string) { color.Red(s) } func ErrorWithExit(s string) { color.Red(s) os.Exit(1) } type KV struct { K string V string } type KVTable struct { KVs []KV } func (k *KVTable) Print() { table := uitable.New() table.MaxColWidth = 100 table.Wrap = true // wrap columns table.AddRow("") for _, i := range k.KVs { if i.V == "" { table.AddRow(i.K, "-") } else { table.AddRow(i.K, i.V) } } fmt.Println(table) }