mirror of https://github.com/containers/podman.git
Merge pull request #5582 from kunalkushwaha/bugfix-5001
Improved readability in image json output
This commit is contained in:
commit
31d14457a5
|
@ -13,8 +13,8 @@ import (
|
||||||
"github.com/containers/libpod/cmd/podman/cliconfig"
|
"github.com/containers/libpod/cmd/podman/cliconfig"
|
||||||
"github.com/containers/libpod/libpod/image"
|
"github.com/containers/libpod/libpod/image"
|
||||||
"github.com/containers/libpod/pkg/adapter"
|
"github.com/containers/libpod/pkg/adapter"
|
||||||
"github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
"github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -34,14 +34,15 @@ type imagesTemplateParams struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type imagesJSONParams struct {
|
type imagesJSONParams struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"ID"`
|
||||||
Name []string `json:"names"`
|
Name []string `json:"Names"`
|
||||||
Digest digest.Digest `json:"digest"`
|
Created string `json:"Created"`
|
||||||
Digests []digest.Digest `json:"digests"`
|
Digest digest.Digest `json:"Digest"`
|
||||||
Created time.Time `json:"created"`
|
Digests []digest.Digest `json:"Digests"`
|
||||||
Size *uint64 `json:"size"`
|
CreatedAt time.Time `json:"CreatedAt"`
|
||||||
ReadOnly bool `json:"readonly"`
|
Size *uint64 `json:"Size"`
|
||||||
History []string `json:"history"`
|
ReadOnly bool `json:"ReadOnly"`
|
||||||
|
History []string `json:"History"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type imagesOptions struct {
|
type imagesOptions struct {
|
||||||
|
@ -348,7 +349,8 @@ func getImagesJSONOutput(ctx context.Context, images []*adapter.ContainerImage)
|
||||||
Name: img.Names(),
|
Name: img.Names(),
|
||||||
Digest: img.Digest(),
|
Digest: img.Digest(),
|
||||||
Digests: img.Digests(),
|
Digests: img.Digests(),
|
||||||
Created: img.Created(),
|
Created: units.HumanDuration(time.Since(img.Created())) + " ago",
|
||||||
|
CreatedAt: img.Created(),
|
||||||
Size: size,
|
Size: size,
|
||||||
ReadOnly: img.IsReadOnly(),
|
ReadOnly: img.IsReadOnly(),
|
||||||
History: img.NamesHistory(),
|
History: img.NamesHistory(),
|
||||||
|
|
|
@ -27,11 +27,11 @@ load helpers
|
||||||
@test "podman images - json" {
|
@test "podman images - json" {
|
||||||
# 'created': podman includes fractional seconds, podman-remote does not
|
# 'created': podman includes fractional seconds, podman-remote does not
|
||||||
tests="
|
tests="
|
||||||
names[0] | $PODMAN_TEST_IMAGE_FQN
|
Names[0] | $PODMAN_TEST_IMAGE_FQN
|
||||||
id | [0-9a-f]\\\{64\\\}
|
ID | [0-9a-f]\\\{64\\\}
|
||||||
digest | sha256:[0-9a-f]\\\{64\\\}
|
Digest | sha256:[0-9a-f]\\\{64\\\}
|
||||||
created | [0-9-]\\\+T[0-9:.]\\\+Z
|
CreatedAt | [0-9-]\\\+T[0-9:.]\\\+Z
|
||||||
size | [0-9]\\\+
|
Size | [0-9]\\\+
|
||||||
"
|
"
|
||||||
|
|
||||||
run_podman images -a --format json
|
run_podman images -a --format json
|
||||||
|
|
Loading…
Reference in New Issue