mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +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)
|
||||
}
|
||||
|
||||
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 {
|
||||
|
Reference in New Issue
Block a user