mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
command: placeholder for <none> in kv output
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user