diff options
author | Jhon Honce <jhonce@redhat.com> | 2021-12-02 11:05:03 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2021-12-03 13:48:58 -0700 |
commit | 7d22cc88ef382033c59d09570d1525189e104eae (patch) | |
tree | 19c00abc3c22f7ae1a49e1a616864426fed5fe0a /cmd/podman/system/events.go | |
parent | a50502dd3d8ef5c80d686824ba2023927825fd2c (diff) | |
download | podman-7d22cc88ef382033c59d09570d1525189e104eae.tar.gz podman-7d22cc88ef382033c59d09570d1525189e104eae.tar.bz2 podman-7d22cc88ef382033c59d09570d1525189e104eae.zip |
Refactor podman system to report.Formatter
[NO NEW TESTS NEEDED]
Support better compatibility output for podman system commands
* Format and content of output from podman version changed to
be more compatible
See #10974
Depends on containers/common#831
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/system/events.go')
-rw-r--r-- | cmd/podman/system/events.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/podman/system/events.go b/cmd/podman/system/events.go index e698e6652..881b9b8f4 100644 --- a/cmd/podman/system/events.go +++ b/cmd/podman/system/events.go @@ -77,7 +77,7 @@ func eventsCmd(cmd *cobra.Command, _ []string) error { errChannel := make(chan error) var ( - tmpl *report.Template + rpt *report.Formatter doJSON bool ) @@ -85,7 +85,7 @@ func eventsCmd(cmd *cobra.Command, _ []string) error { doJSON = report.IsJSON(eventFormat) if !doJSON { var err error - tmpl, err = report.NewTemplate("events").Parse(eventFormat) + rpt, err = report.New(os.Stdout, cmd.Name()).Parse(report.OriginUser, eventFormat) if err != nil { return err } @@ -108,10 +108,10 @@ func eventsCmd(cmd *cobra.Command, _ []string) error { } fmt.Println(jsonStr) case cmd.Flags().Changed("format"): - if err := tmpl.Execute(os.Stdout, event); err != nil { + if err := rpt.Execute(event); err != nil { return err } - fmt.Println("") + os.Stdout.WriteString("\n") default: fmt.Println(event.ToHumanReadable(!noTrunc)) } |