summaryrefslogtreecommitdiff
path: root/cmd/podman/report/diff.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-10-20 10:29:49 -0700
committerJhon Honce <jhonce@redhat.com>2020-10-21 08:16:52 -0700
commitbab3cda0e81fa3ac3315601f5ec17724f3ad8ed5 (patch)
tree14ad37445fe86fc55db7907d657f40f0027d92b8 /cmd/podman/report/diff.go
parentf96dbd0896eac8730142cf694485543275764195 (diff)
downloadpodman-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/report/diff.go')
-rw-r--r--cmd/podman/report/diff.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/cmd/podman/report/diff.go b/cmd/podman/report/diff.go
deleted file mode 100644
index edd324bfe..000000000
--- a/cmd/podman/report/diff.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package report
-
-import (
- "fmt"
- "os"
-
- "github.com/containers/podman/v2/pkg/domain/entities"
- "github.com/containers/storage/pkg/archive"
- "github.com/pkg/errors"
-)
-
-type ChangesReportJSON struct {
- Changed []string `json:"changed,omitempty"`
- Added []string `json:"added,omitempty"`
- Deleted []string `json:"deleted,omitempty"`
-}
-
-func ChangesToJSON(diffs *entities.DiffReport) error {
- body := ChangesReportJSON{}
- for _, row := range diffs.Changes {
- switch row.Kind {
- case archive.ChangeAdd:
- body.Added = append(body.Added, row.Path)
- case archive.ChangeDelete:
- body.Deleted = append(body.Deleted, row.Path)
- case archive.ChangeModify:
- body.Changed = append(body.Changed, row.Path)
- default:
- return errors.Errorf("output kind %q not recognized", row.Kind)
- }
- }
-
- // Pull in configured json library
- enc := json.NewEncoder(os.Stdout)
- return enc.Encode(body)
-}
-
-func ChangesToTable(diffs *entities.DiffReport) error {
- for _, row := range diffs.Changes {
- fmt.Fprintln(os.Stdout, row.String())
- }
- return nil
-}