diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-10-09 09:13:22 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-10-13 17:28:45 -0700 |
commit | eb4a746efcb9e76e29942461b97da797fd67109f (patch) | |
tree | 980663ba01f79bd107980fd0c3205fe833503a41 /cmd/podman/system/info.go | |
parent | 7ad631b819d991559ba20e4728a6803a2546158f (diff) | |
download | podman-eb4a746efcb9e76e29942461b97da797fd67109f.tar.gz podman-eb4a746efcb9e76e29942461b97da797fd67109f.tar.bz2 podman-eb4a746efcb9e76e29942461b97da797fd67109f.zip |
Restore --format table support
* system df
* events
* fix error handling from go routine
* update tests to use gomega matchers for better error messages
* system info
* version
* volume inspect
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/system/info.go')
-rw-r--r-- | cmd/podman/system/info.go | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/cmd/podman/system/info.go b/cmd/podman/system/info.go index 3e3c99488..ee720abf8 100644 --- a/cmd/podman/system/info.go +++ b/cmd/podman/system/info.go @@ -69,26 +69,25 @@ func info(cmd *cobra.Command, args []string) error { return err } - if parse.MatchesJSONFormat(inFormat) { + switch { + case parse.MatchesJSONFormat(inFormat): b, err := json.MarshalIndent(info, "", " ") if err != nil { return err } fmt.Println(string(b)) - return nil - } - if !cmd.Flag("format").Changed { + case cmd.Flags().Changed("format"): + tmpl, err := template.New("info").Parse(inFormat) + if err != nil { + return err + } + return tmpl.Execute(os.Stdout, info) + default: b, err := yaml.Marshal(info) if err != nil { return err } fmt.Println(string(b)) - return nil - } - tmpl, err := template.New("info").Parse(inFormat) - if err != nil { - return err } - err = tmpl.Execute(os.Stdout, info) - return err + return nil } |