summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-19 10:44:54 -0400
committerGitHub <noreply@github.com>2020-06-19 10:44:54 -0400
commit33a60276135b7d74f3a10b39d8d69c836a05766e (patch)
tree235c6ee0aabaf72d6099f580fd0dfdcb71777a56
parent5ec29f8d4e79500915ec79824d9eb21630205f3f (diff)
parentbba433ed926a8ba78e628e1a1d9861ac5ed35e54 (diff)
downloadpodman-33a60276135b7d74f3a10b39d8d69c836a05766e.tar.gz
podman-33a60276135b7d74f3a10b39d8d69c836a05766e.tar.bz2
podman-33a60276135b7d74f3a10b39d8d69c836a05766e.zip
Merge pull request #6690 from vrothberg/fix-6687
podman images --format json: pretty print
-rw-r--r--cmd/podman/images/list.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 236ae15b4..4a9df5712 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -141,8 +141,12 @@ func writeJSON(imageS []*entities.ImageSummary) error {
imgs = append(imgs, h)
}
- enc := json.NewEncoder(os.Stdout)
- return enc.Encode(imgs)
+ prettyJSON, err := json.MarshalIndent(imgs, "", " ")
+ if err != nil {
+ return err
+ }
+ fmt.Println(string(prettyJSON))
+ return nil
}
func writeTemplate(imageS []*entities.ImageSummary) error {