summaryrefslogtreecommitdiff
path: root/cmd/podman/images/history.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-04-22 17:33:13 -0700
committerJhon Honce <jhonce@redhat.com>2020-04-29 08:24:56 -0700
commita9cc13448ee3185bb63f4c3eef94e755e79b8571 (patch)
treee91e17ca9c46540aedbec46e7268ba5f65b24d0c /cmd/podman/images/history.go
parent27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685 (diff)
downloadpodman-a9cc13448ee3185bb63f4c3eef94e755e79b8571.tar.gz
podman-a9cc13448ee3185bb63f4c3eef94e755e79b8571.tar.bz2
podman-a9cc13448ee3185bb63f4c3eef94e755e79b8571.zip
V2 Restore images list tests
* Fix history --quiet formatting * Fix image inspect --format=json * Fix image list --sort Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/images/history.go')
-rw-r--r--cmd/podman/images/history.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index b8d216cc1..ce153aa46 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -89,22 +89,20 @@ func history(cmd *cobra.Command, args []string) error {
hdr := "ID\tCREATED\tCREATED BY\tSIZE\tCOMMENT\n"
row := "{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n"
- if len(opts.format) > 0 {
+ switch {
+ case len(opts.format) > 0:
hdr = ""
row = opts.format
if !strings.HasSuffix(opts.format, "\n") {
row += "\n"
}
- } else {
- switch {
- case opts.human:
- row = "{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n"
- case opts.noTrunc:
- row = "{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n"
- case opts.quiet:
- hdr = ""
- row = "{{.ID}}\n"
- }
+ case opts.quiet:
+ hdr = ""
+ row = "{{.ID}}\n"
+ case opts.human:
+ row = "{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n"
+ case opts.noTrunc:
+ row = "{{.ID}}\t{{.Created}}\t{{.CreatedBy}}\t{{.Size}}\t{{.Comment}}\n"
}
format := hdr + "{{range . }}" + row + "{{end}}"