diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-09 03:00:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 03:00:40 +0200 |
commit | 12293503775a0239094fb19dee140d879cf2d8d3 (patch) | |
tree | 60612cac7059e3f2b5ccf9f83fc08f8603ecb5f7 /cmd/podmanV2 | |
parent | f71e4d3d3e6da338a253c951920d2e8671773864 (diff) | |
parent | 90884ac2d2394df67241410415f74b69d894681a (diff) | |
download | podman-12293503775a0239094fb19dee140d879cf2d8d3.tar.gz podman-12293503775a0239094fb19dee140d879cf2d8d3.tar.bz2 podman-12293503775a0239094fb19dee140d879cf2d8d3.zip |
Merge pull request #5748 from baude/v2imageformat
podmanv2 images user format
Diffstat (limited to 'cmd/podmanV2')
-rw-r--r-- | cmd/podmanV2/images/list.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd/podmanV2/images/list.go b/cmd/podmanV2/images/list.go index 2d6cb3596..6b02e239e 100644 --- a/cmd/podmanV2/images/list.go +++ b/cmd/podmanV2/images/list.go @@ -130,6 +130,9 @@ func writeJSON(imageS []*entities.ImageSummary) error { } func writeTemplate(imageS []*entities.ImageSummary, err error) error { + var ( + hdr, row string + ) type image struct { entities.ImageSummary Repository string `json:"repository,omitempty"` @@ -148,10 +151,15 @@ func writeTemplate(imageS []*entities.ImageSummary, err error) error { listFlag.readOnly = true } } - - hdr, row := imageListFormat(listFlag) + if len(listFlag.format) < 1 { + hdr, row = imageListFormat(listFlag) + } else { + row = listFlag.format + if !strings.HasSuffix(row, "\n") { + row += "\n" + } + } format := hdr + "{{range . }}" + row + "{{end}}" - tmpl := template.Must(template.New("list").Funcs(report.PodmanTemplateFuncs()).Parse(format)) w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0) defer w.Flush() |