summaryrefslogtreecommitdiff
path: root/cmd/podman/images
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-21 17:59:56 -0400
committerGitHub <noreply@github.com>2020-10-21 17:59:56 -0400
commit2bd920b00540280696d19dc95ab6e562aebd6b7d (patch)
tree76e7bd0ff448253d4d4ec23f41865297161a973b /cmd/podman/images
parent61b276a05c1c8adc51c6d4f7c061b89ce39a803b (diff)
parentbab3cda0e81fa3ac3315601f5ec17724f3ad8ed5 (diff)
downloadpodman-2bd920b00540280696d19dc95ab6e562aebd6b7d.tar.gz
podman-2bd920b00540280696d19dc95ab6e562aebd6b7d.tar.bz2
podman-2bd920b00540280696d19dc95ab6e562aebd6b7d.zip
Merge pull request #8077 from jwhonce/wip/report
Refactor podman to use c/common/pkg/report
Diffstat (limited to 'cmd/podman/images')
-rw-r--r--cmd/podman/images/diff.go10
-rw-r--r--cmd/podman/images/history.go5
-rw-r--r--cmd/podman/images/list.go5
-rw-r--r--cmd/podman/images/mount.go4
-rw-r--r--cmd/podman/images/search.go2
5 files changed, 12 insertions, 14 deletions
diff --git a/cmd/podman/images/diff.go b/cmd/podman/images/diff.go
index ed572ffdb..b7722e5e5 100644
--- a/cmd/podman/images/diff.go
+++ b/cmd/podman/images/diff.go
@@ -1,9 +1,9 @@
package images
import (
- "github.com/containers/podman/v2/cmd/podman/parse"
+ "github.com/containers/common/pkg/report"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
- "github.com/containers/podman/v2/cmd/podman/report"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -51,10 +51,10 @@ func diff(cmd *cobra.Command, args []string) error {
}
switch {
- case parse.MatchesJSONFormat(diffOpts.Format):
- return report.ChangesToJSON(results)
+ case report.IsJSON(diffOpts.Format):
+ return common.ChangesToJSON(results)
case diffOpts.Format == "":
- return report.ChangesToTable(results)
+ return common.ChangesToTable(results)
default:
return errors.New("only supported value for '--format' is 'json'")
}
diff --git a/cmd/podman/images/history.go b/cmd/podman/images/history.go
index aac978137..3075218d1 100644
--- a/cmd/podman/images/history.go
+++ b/cmd/podman/images/history.go
@@ -10,9 +10,8 @@ import (
"time"
"unicode"
- "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/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/pkg/errors"
@@ -81,7 +80,7 @@ func history(cmd *cobra.Command, args []string) error {
return err
}
- if parse.MatchesJSONFormat(opts.format) {
+ if report.IsJSON(opts.format) {
var err error
if len(results.Layers) == 0 {
_, err = fmt.Fprintf(os.Stdout, "[]\n")
diff --git a/cmd/podman/images/list.go b/cmd/podman/images/list.go
index e8f1ca9b4..489b15086 100644
--- a/cmd/podman/images/list.go
+++ b/cmd/podman/images/list.go
@@ -10,10 +10,9 @@ import (
"time"
"unicode"
+ "github.com/containers/common/pkg/report"
"github.com/containers/image/v5/docker/reference"
- "github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
- "github.com/containers/podman/v2/cmd/podman/report"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/docker/go-units"
"github.com/pkg/errors"
@@ -108,7 +107,7 @@ func images(cmd *cobra.Command, args []string) error {
switch {
case listFlag.quiet:
return writeID(imgs)
- case parse.MatchesJSONFormat(listFlag.format):
+ case report.IsJSON(listFlag.format):
return writeJSON(imgs)
default:
if cmd.Flag("format").Changed {
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go
index db34d11d6..28e9264ee 100644
--- a/cmd/podman/images/mount.go
+++ b/cmd/podman/images/mount.go
@@ -6,7 +6,7 @@ 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/utils"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -80,7 +80,7 @@ func mount(cmd *cobra.Command, args []string) error {
}
switch {
- case parse.MatchesJSONFormat(mountOpts.Format):
+ case report.IsJSON(mountOpts.Format):
return printJSON(reports)
case mountOpts.Format == "":
break // default format
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index a30dfe9c9..b1a1442a6 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -6,9 +6,9 @@ import (
"text/template"
"github.com/containers/common/pkg/auth"
+ "github.com/containers/common/pkg/report"
"github.com/containers/image/v5/types"
"github.com/containers/podman/v2/cmd/podman/registry"
- "github.com/containers/podman/v2/cmd/podman/report"
"github.com/containers/podman/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/spf13/cobra"