mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
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 <rothberg@redhat.com>
This commit is contained in:
@ -141,8 +141,12 @@ func writeJSON(imageS []*entities.ImageSummary) error {
|
|||||||
imgs = append(imgs, h)
|
imgs = append(imgs, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
enc := json.NewEncoder(os.Stdout)
|
prettyJSON, err := json.MarshalIndent(imgs, "", " ")
|
||||||
return enc.Encode(imgs)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println(string(prettyJSON))
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeTemplate(imageS []*entities.ImageSummary) error {
|
func writeTemplate(imageS []*entities.ImageSummary) error {
|
||||||
|
Reference in New Issue
Block a user