diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-10-20 10:29:49 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-10-21 08:16:52 -0700 |
commit | bab3cda0e81fa3ac3315601f5ec17724f3ad8ed5 (patch) | |
tree | 14ad37445fe86fc55db7907d657f40f0027d92b8 /cmd/podman/pods | |
parent | f96dbd0896eac8730142cf694485543275764195 (diff) | |
download | podman-bab3cda0e81fa3ac3315601f5ec17724f3ad8ed5.tar.gz podman-bab3cda0e81fa3ac3315601f5ec17724f3ad8ed5.tar.bz2 podman-bab3cda0e81fa3ac3315601f5ec17724f3ad8ed5.zip |
Refactor podman to use c/common/pkg/report
All formatting for containers stack moved into one package
The does not correct issue with headers when using custom tables
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r-- | cmd/podman/pods/inspect.go | 5 | ||||
-rw-r--r-- | cmd/podman/pods/ps.go | 5 | ||||
-rw-r--r-- | cmd/podman/pods/stats.go | 5 |
3 files changed, 6 insertions, 9 deletions
diff --git a/cmd/podman/pods/inspect.go b/cmd/podman/pods/inspect.go index 142c8d270..d5e026d38 100644 --- a/cmd/podman/pods/inspect.go +++ b/cmd/podman/pods/inspect.go @@ -7,9 +7,8 @@ import ( "text/tabwriter" "text/template" - "github.com/containers/podman/v2/cmd/podman/parse" + "github.com/containers/common/pkg/report" "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/cmd/podman/report" "github.com/containers/podman/v2/cmd/podman/validate" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/pkg/errors" @@ -62,7 +61,7 @@ func inspect(cmd *cobra.Command, args []string) error { return err } - if parse.MatchesJSONFormat(inspectOptions.Format) { + if report.IsJSON(inspectOptions.Format) { enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") return enc.Encode(responses) diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go index 0013cca02..714d4130f 100644 --- a/cmd/podman/pods/ps.go +++ b/cmd/podman/pods/ps.go @@ -10,9 +10,8 @@ import ( "text/template" "time" - "github.com/containers/podman/v2/cmd/podman/parse" + "github.com/containers/common/pkg/report" "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/cmd/podman/report" "github.com/containers/podman/v2/cmd/podman/validate" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/docker/go-units" @@ -85,7 +84,7 @@ func pods(cmd *cobra.Command, _ []string) error { } switch { - case parse.MatchesJSONFormat(psInput.Format): + case report.IsJSON(psInput.Format): b, err := json.MarshalIndent(responses, "", " ") if err != nil { return err diff --git a/cmd/podman/pods/stats.go b/cmd/podman/pods/stats.go index 2f59e4e47..953494918 100644 --- a/cmd/podman/pods/stats.go +++ b/cmd/podman/pods/stats.go @@ -9,9 +9,8 @@ import ( "time" "github.com/buger/goterm" - "github.com/containers/podman/v2/cmd/podman/parse" + "github.com/containers/common/pkg/report" "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/cmd/podman/report" "github.com/containers/podman/v2/cmd/podman/validate" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/spf13/cobra" @@ -66,7 +65,7 @@ func stats(cmd *cobra.Command, args []string) error { } row := report.NormalizeFormat(statsOptions.Format) - doJSON := parse.MatchesJSONFormat(row) + doJSON := report.IsJSON(row) headers := report.Headers(entities.PodStatsReport{}, map[string]string{ "CPU": "CPU %", |