diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-19 10:44:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-19 10:44:54 -0400 |
commit | 33a60276135b7d74f3a10b39d8d69c836a05766e (patch) | |
tree | 235c6ee0aabaf72d6099f580fd0dfdcb71777a56 /cmd/podman/images/list.go | |
parent | 5ec29f8d4e79500915ec79824d9eb21630205f3f (diff) | |
parent | bba433ed926a8ba78e628e1a1d9861ac5ed35e54 (diff) | |
download | podman-33a60276135b7d74f3a10b39d8d69c836a05766e.tar.gz podman-33a60276135b7d74f3a10b39d8d69c836a05766e.tar.bz2 podman-33a60276135b7d74f3a10b39d8d69c836a05766e.zip |
Merge pull request #6690 from vrothberg/fix-6687
podman images --format json: pretty print
Diffstat (limited to 'cmd/podman/images/list.go')
-rw-r--r-- | cmd/podman/images/list.go | 8 |
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 { |