Skip to content

Commit

Permalink
feat(cli): output keys in multiple namespaces as a table
Browse files Browse the repository at this point in the history
  • Loading branch information
imiric committed Apr 16, 2024
1 parent 823e7fe commit 2c1235c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/cli/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ func (c *Ls) Run(appCtx *actx.Context) error {
}
slices.Sort(namespaces)

data := make([][]string, 0)
for _, ns := range namespaces {
for _, key := range keysPerNS[ns] {
fmt.Fprintf(appCtx.Stdout, "%s:%s\n", ns, key)
for i, key := range keysPerNS[ns] {
row := []string{ns, key}
if i > 0 {
row[0] = ""
}
data = append(data, row)
}
}

header := []string{"Namespace", "Key"}
newTable(header, data, appCtx.Stdout).Render()
} else {
for ns := range keysPerNS {
for _, key := range keysPerNS[ns] {
Expand Down

0 comments on commit 2c1235c

Please sign in to comment.