mirror of https://github.com/containers/podman.git
podmanv2 images user format
honor the format provided by user for output Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
parent
c0e29b4a31
commit
90884ac2d2
|
|
@ -130,6 +130,9 @@ func writeJSON(imageS []*entities.ImageSummary) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeTemplate(imageS []*entities.ImageSummary, err error) error {
|
func writeTemplate(imageS []*entities.ImageSummary, err error) error {
|
||||||
|
var (
|
||||||
|
hdr, row string
|
||||||
|
)
|
||||||
type image struct {
|
type image struct {
|
||||||
entities.ImageSummary
|
entities.ImageSummary
|
||||||
Repository string `json:"repository,omitempty"`
|
Repository string `json:"repository,omitempty"`
|
||||||
|
|
@ -148,10 +151,15 @@ func writeTemplate(imageS []*entities.ImageSummary, err error) error {
|
||||||
listFlag.readOnly = true
|
listFlag.readOnly = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(listFlag.format) < 1 {
|
||||||
hdr, row := imageListFormat(listFlag)
|
hdr, row = imageListFormat(listFlag)
|
||||||
|
} else {
|
||||||
|
row = listFlag.format
|
||||||
|
if !strings.HasSuffix(row, "\n") {
|
||||||
|
row += "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
format := hdr + "{{range . }}" + row + "{{end}}"
|
format := hdr + "{{range . }}" + row + "{{end}}"
|
||||||
|
|
||||||
tmpl := template.Must(template.New("list").Funcs(report.PodmanTemplateFuncs()).Parse(format))
|
tmpl := template.Must(template.New("list").Funcs(report.PodmanTemplateFuncs()).Parse(format))
|
||||||
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
|
||||||
defer w.Flush()
|
defer w.Flush()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue