command: placeholder for <none> in kv output
This commit is contained in:
parent
5ce6f4bb64
commit
079b3c753a
|
@ -8,6 +8,7 @@ import (
|
|||
// aligned k = v pairs using the columnize library.
|
||||
func formatKV(in []string) string {
|
||||
columnConf := columnize.DefaultConfig()
|
||||
columnConf.Empty = "<none>"
|
||||
columnConf.Glue = " = "
|
||||
return columnize.Format(in, columnConf)
|
||||
}
|
||||
|
|
|
@ -5,11 +5,12 @@ import (
|
|||
)
|
||||
|
||||
func TestHelpers_FormatKV(t *testing.T) {
|
||||
in := []string{"alpha|beta", "charlie|delta"}
|
||||
in := []string{"alpha|beta", "charlie|delta", "echo|"}
|
||||
out := formatKV(in)
|
||||
|
||||
expect := "alpha = beta\n"
|
||||
expect += "charlie = delta"
|
||||
expect += "charlie = delta\n"
|
||||
expect += "echo = <none>"
|
||||
|
||||
if out != expect {
|
||||
t.Fatalf("expect: %s, got: %s", expect, out)
|
||||
|
|
Loading…
Reference in New Issue