diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-29 18:53:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 18:53:06 +0200 |
commit | 06dce0c7709f3890ec3dad7993c24c5cdaaf62f9 (patch) | |
tree | e91e17ca9c46540aedbec46e7268ba5f65b24d0c /cmd/podman/images/history.go | |
parent | 27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685 (diff) | |
parent | a9cc13448ee3185bb63f4c3eef94e755e79b8571 (diff) | |
download | podman-06dce0c7709f3890ec3dad7993c24c5cdaaf62f9.tar.gz podman-06dce0c7709f3890ec3dad7993c24c5cdaaf62f9.tar.bz2 podman-06dce0c7709f3890ec3dad7993c24c5cdaaf62f9.zip |
Merge pull request #5949 from jwhonce/jira/796
V2 Restore images list tests
Diffstat (limited to 'cmd/podman/images/history.go')
-rw-r--r-- | cmd/podman/images/history.go | 20 |
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}}" |