From bba433ed926a8ba78e628e1a1d9861ac5ed35e54 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Fri, 19 Jun 2020 15:30:32 +0200 Subject: podman images --format json: pretty print Pretty print the JSON output when listing images. We regressed on that during v2 development. The indentation is now identical to the one of Podman v1.9.3. Fixes: #6687 Signed-off-by: Valentin Rothberg --- cmd/podman/images/list.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cmd/podman/images') 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 { -- cgit v1.2.3-54-g00ecf