aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/images/list.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/images/list.go')
-rw-r--r--cmd/podman/images/list.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index 489b15086..e24631b24 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/common/pkg/report"
"github.com/containers/image/v5/docker/reference"
+ "github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
@@ -105,10 +106,10 @@ func images(cmd *cobra.Command, args []string) error {
return err
}
switch {
- case listFlag.quiet:
- return writeID(imgs)
case report.IsJSON(listFlag.format):
return writeJSON(imgs)
+ case listFlag.quiet:
+ return writeID(imgs)
default:
if cmd.Flag("format").Changed {
listFlag.noHeading = true // V1 compatibility
@@ -171,9 +172,13 @@ func writeTemplate(imgs []imageReporter) error {
} else {
row = report.NormalizeFormat(listFlag.format)
}
+ format := parse.EnforceRange(row)
+
+ tmpl, err := template.New("list").Parse(format)
+ if err != nil {
+ return err
+ }
- format := "{{range . }}" + row + "{{end}}"
- tmpl := template.Must(template.New("list").Parse(format))
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
defer w.Flush()