diff --git a/CHANGELOG.md b/CHANGELOG.md index d625fce..02de3cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pkg/cmd/operations.go b/pkg/cmd/operations.go index 2ed51a0..5186c7a 100644 --- a/pkg/cmd/operations.go +++ b/pkg/cmd/operations.go @@ -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) + } }, } @@ -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) + } }, } )