Skip to content

Commit a255e8a

Browse files
committed
chore(workflow-cli): optimize output
1 parent c97e75b commit a255e8a

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

cmd/config.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ func (d *DryccCmd) ConfigList(appID string, format string) error {
3636
d.Println(fmt.Sprintf("%s=%s", key, config.Values[key]))
3737
}
3838
default:
39-
table := d.getDefaultFormatTable([]string{})
39+
table := d.getDefaultFormatTable([]string{"UUID", "OWNER", "NAME", "VALUE"})
4040
for _, key := range keys {
41-
table.Append([]string{key, fmt.Sprintf("%v", config.Values[key])})
41+
table.Append([]string{
42+
config.UUID,
43+
config.Owner,
44+
key,
45+
fmt.Sprintf("%v", config.Values[key]),
46+
})
4247
}
4348
table.Render()
4449
}

cmd/config_test.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ func TestConfigList(t *testing.T) {
121121
err = cmdr.ConfigList("foo", "")
122122
assert.NoError(t, err)
123123

124-
assert.Equal(t, b.String(), `FLOAT 12.34
125-
NCC 1701
126-
TEST testing
127-
TRUE false
124+
assert.Equal(t, b.String(), `UUID OWNER NAME VALUE
125+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk FLOAT 12.34
126+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk NCC 1701
127+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk TEST testing
128+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk TRUE false
128129
`, "output")
129130
b.Reset()
130131

@@ -186,11 +187,12 @@ func TestConfigSet(t *testing.T) {
186187

187188
assert.Equal(t, testutil.StripProgress(b.String()), `Creating config... done
188189
189-
FLOAT 12.34
190-
NCC 1701
191-
SSH_KEY LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0=
192-
TEST testing
193-
TRUE false
190+
UUID OWNER NAME VALUE
191+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk FLOAT 12.34
192+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk NCC 1701
193+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk SSH_KEY LS0tLS1CRUdJTiBPUEVOU1NIIFBSSVZBVEUgS0VZLS0tLS0=
194+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk TEST testing
195+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk TRUE false
194196
`, "output")
195197
}
196198

@@ -239,9 +241,10 @@ func TestConfigUnset(t *testing.T) {
239241

240242
assert.Equal(t, testutil.StripProgress(b.String()), `Removing config... done
241243
242-
FLOAT 12.34
243-
NCC 1701
244-
TEST testing
245-
TRUE false
244+
UUID OWNER NAME VALUE
245+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk FLOAT 12.34
246+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk NCC 1701
247+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk TEST testing
248+
de1bf5b5-4a72-4f94-a10c-d2a3741cdf75 jkirk TRUE false
246249
`, "output")
247250
}

0 commit comments

Comments
 (0)