summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2019-04-09 14:00:21 -0400
committerMatthew Heon <mheon@redhat.com>2019-04-10 09:55:55 -0400
commitba4a1bb9bd4a644ffa7b07d2a15ec9302d5d45ed (patch)
tree7c0fbe29535d360c5027554eda3e54b35efdd8c6 /cmd/podman
parentfe79bdd07e140176dc64ebef8da3eea2ae28b96b (diff)
downloadpodman-ba4a1bb9bd4a644ffa7b07d2a15ec9302d5d45ed.tar.gz
podman-ba4a1bb9bd4a644ffa7b07d2a15ec9302d5d45ed.tar.bz2
podman-ba4a1bb9bd4a644ffa7b07d2a15ec9302d5d45ed.zip
Print header for 'podman images' even with no images
Fixes #2877 Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/images.go7
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: