summaryrefslogtreecommitdiff
path: root/cmd/podman/system/info.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/system/info.go')
-rw-r--r--cmd/podman/system/info.go21
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
}