Skip to content

Commit

Permalink
fix: list operations - domains,objects - print ndjson lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanconway committed Jul 31, 2024
1 parent 70e38c3 commit d4690d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - 2024-05-30

### Added
- For REST operations that return lists, print newline-separated JSON objects (ndjson)

## [0.0.1] - 2024-05-30

### Added
Expand Down
10 changes: 8 additions & 2 deletions pkg/cmd/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ var domainsCmd = &cobra.Command{
c := newClient()
ok, err := c.Operations.GetDomains(&operations.GetDomainsParams{})
check(err)
NewPrinter(output.String(), os.Stdout)(ok.Payload)
p := NewPrinter(output.String(), os.Stdout)
for _, v := range ok.Payload {
p(v)
}
},
}

Expand All @@ -50,7 +53,10 @@ var (
c := newClient()
ok, err := c.Operations.GetObjects(&operations.GetObjectsParams{Query: args[0]})
check(err)
NewPrinter(output.String(), os.Stdout)(ok.Payload)
p := NewPrinter(output.String(), os.Stdout)
for _, v := range ok.Payload {
p(v)
}
},
}
)
Expand Down

0 comments on commit d4690d9

Please sign in to comment.