summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorKunal Kushwaha <kunal.kushwaha@gmail.com>2020-03-22 16:54:11 +0900
committerKunal Kushwaha <kunal.kushwaha@gmail.com>2020-03-22 21:38:07 +0900
commit19bf7adedbfe6e65f29e9fa53c5c4a1d4b110cc5 (patch)
tree4f4a42d80378ab7c1104f916192c115258ff2d63 /cmd
parent2b2996d09d1d99c41a5c944b597e6b0c83ab23ee (diff)
downloadpodman-19bf7adedbfe6e65f29e9fa53c5c4a1d4b110cc5.tar.gz
podman-19bf7adedbfe6e65f29e9fa53c5c4a1d4b110cc5.tar.bz2
podman-19bf7adedbfe6e65f29e9fa53c5c4a1d4b110cc5.zip
Improved readability in image json output
Changes made in json output to improve readability of podman images output. Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/images.go38
1 files changed, 20 insertions, 18 deletions
diff --git a/cmd/podman/images.go b/cmd/podman/images.go
index 41790a5aa..ed33402ab 100644
--- a/cmd/podman/images.go
+++ b/cmd/podman/images.go
@@ -13,8 +13,8 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod/image"
"github.com/containers/libpod/pkg/adapter"
- "github.com/docker/go-units"
- "github.com/opencontainers/go-digest"
+ units "github.com/docker/go-units"
+ digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -34,14 +34,15 @@ type imagesTemplateParams struct {
}
type imagesJSONParams struct {
- ID string `json:"id"`
- Name []string `json:"names"`
- Digest digest.Digest `json:"digest"`
- Digests []digest.Digest `json:"digests"`
- Created time.Time `json:"created"`
- Size *uint64 `json:"size"`
- ReadOnly bool `json:"readonly"`
- History []string `json:"history"`
+ ID string `json:"ID"`
+ Name []string `json:"Names"`
+ Created string `json:"Created"`
+ Digest digest.Digest `json:"Digest"`
+ Digests []digest.Digest `json:"Digests"`
+ CreatedAt time.Time `json:"CreatedAt"`
+ Size *uint64 `json:"Size"`
+ ReadOnly bool `json:"ReadOnly"`
+ History []string `json:"History"`
}
type imagesOptions struct {
@@ -344,14 +345,15 @@ func getImagesJSONOutput(ctx context.Context, images []*adapter.ContainerImage)
size = nil
}
params := imagesJSONParams{
- ID: img.ID(),
- Name: img.Names(),
- Digest: img.Digest(),
- Digests: img.Digests(),
- Created: img.Created(),
- Size: size,
- ReadOnly: img.IsReadOnly(),
- History: img.NamesHistory(),
+ ID: img.ID(),
+ Name: img.Names(),
+ Digest: img.Digest(),
+ Digests: img.Digests(),
+ Created: units.HumanDuration(time.Since(img.Created())) + " ago",
+ CreatedAt: img.Created(),
+ Size: size,
+ ReadOnly: img.IsReadOnly(),
+ History: img.NamesHistory(),
}
imagesOutput = append(imagesOutput, params)
}