kpod images: output multiple image names

Output multiple image names, if we have more than one.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-08-17 14:24:25 -04:00
parent 178c1e9ccb
commit 6f27dddf93

View file

@ -137,9 +137,9 @@ func outputImages(store storage.Store, images []storage.Image, truncate, digests
} }
createdTime := img.Created createdTime := img.Created
name := "" names := []string{""}
if len(img.Names) > 0 { if len(img.Names) > 0 {
name = img.Names[0] names = img.Names
} }
info, imageDigest, size, _ := libkpodimage.InfoAndDigestAndSize(store, img) info, imageDigest, size, _ := libkpodimage.InfoAndDigestAndSize(store, img)
@ -149,7 +149,7 @@ func outputImages(store storage.Store, images []storage.Image, truncate, digests
params := imageOutputParams{ params := imageOutputParams{
ID: img.ID, ID: img.ID,
Name: name, Name: names,
Digest: imageDigest, Digest: imageDigest,
CreatedAt: createdTime.Format("Jan 2, 2006 15:04"), CreatedAt: createdTime.Format("Jan 2, 2006 15:04"),
Size: libkpodimage.FormattedSize(float64(size)), Size: libkpodimage.FormattedSize(float64(size)),
@ -173,7 +173,7 @@ func outputImages(store storage.Store, images []storage.Image, truncate, digests
type imageOutputParams struct { type imageOutputParams struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"names"` Name []string `json:"names"`
Digest digest.Digest `json:"digest"` Digest digest.Digest `json:"digest"`
CreatedAt string `json:"created"` CreatedAt string `json:"created"`
Size string `json:"size"` Size string `json:"size"`