diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-04-11 09:59:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 09:59:44 -0700 |
commit | ab259987ee4920e549a863ab3b7055877d6f61d7 (patch) | |
tree | 6a75a64ba3a111973c2ba817ec279ff93c40206f /cmd | |
parent | 4b9a4a12f17ecebb3647165430af9571de45d5bf (diff) | |
parent | ba4a1bb9bd4a644ffa7b07d2a15ec9302d5d45ed (diff) | |
download | podman-ab259987ee4920e549a863ab3b7055877d6f61d7.tar.gz podman-ab259987ee4920e549a863ab3b7055877d6f61d7.tar.bz2 podman-ab259987ee4920e549a863ab3b7055877d6f61d7.zip |
Merge pull request #2879 from mheon/header_on_no_images
Print header for 'podman images' even with no images present
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/images.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 6133450be..bea27e2ff 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -318,13 +318,14 @@ func getImagesJSONOutput(ctx context.Context, images []*adapter.ContainerImage) func generateImagesOutput(ctx context.Context, images []*adapter.ContainerImage, opts imagesOptions) error { templateMap := GenImageOutputMap() - if len(images) == 0 { - return nil - } var out formats.Writer switch opts.format { case formats.JSONString: + // If 0 images are present, print nothing for JSON + if len(images) == 0 { + return nil + } imagesOutput := getImagesJSONOutput(ctx, images) out = formats.JSONStructArray{Output: imagesToGeneric([]imagesTemplateParams{}, imagesOutput)} default: |