diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-09-07 14:43:52 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-09-13 10:33:13 +0200 |
commit | 377599f1f470258e3dea46337f233d2409ae3768 (patch) | |
tree | 181204c9f6ee72c4eb9d303a30dc63ed0290081a | |
parent | f5e13ded93074d4ec61f881c092773c62cde6ab6 (diff) | |
download | podman-377599f1f470258e3dea46337f233d2409ae3768.tar.gz podman-377599f1f470258e3dea46337f233d2409ae3768.tar.bz2 podman-377599f1f470258e3dea46337f233d2409ae3768.zip |
podman secret inspect: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.
I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.
This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.
[1] https://github.com/containers/common/pull/1146
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r-- | cmd/podman/secrets/inspect.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/cmd/podman/secrets/inspect.go b/cmd/podman/secrets/inspect.go index c99e555ba..f4c395b0f 100644 --- a/cmd/podman/secrets/inspect.go +++ b/cmd/podman/secrets/inspect.go @@ -47,20 +47,15 @@ func inspect(cmd *cobra.Command, args []string) error { } if cmd.Flags().Changed("format") { - row := report.NormalizeFormat(format) - formatted := report.EnforceRange(row) + rpt := report.New(os.Stdout, cmd.Name()) + defer rpt.Flush() - tmpl, err := report.NewTemplate("inspect").Parse(formatted) + rpt, err := rpt.Parse(report.OriginUser, format) if err != nil { return err } - w, err := report.NewWriterDefault(os.Stdout) - if err != nil { - return err - } - defer w.Flush() - if err := tmpl.Execute(w, inspected); err != nil { + if err := rpt.Execute(inspected); err != nil { return err } } else { |