diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/main.go | 9 | ||||
-rw-r--r-- | cmd/podman/system/prune.go | 6 | ||||
-rw-r--r-- | cmd/podman/utils/utils.go | 15 |
3 files changed, 21 insertions, 9 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go index c6ba69e94..929c8a757 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -1,7 +1,6 @@ package main import ( - "errors" "fmt" "os" @@ -27,7 +26,6 @@ import ( "github.com/containers/storage/pkg/reexec" "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "github.com/spf13/pflag" ) func main() { @@ -103,13 +101,6 @@ func parseCommands() *cobra.Command { } func flagErrorFuncfunc(c *cobra.Command, e error) error { - // cobra compares via == and not errors.Is so we cannot wrap that error. - // This is required to make podman -h work. - // This can be removed once https://github.com/spf13/cobra/pull/1730 - // is merged and vendored into podman. - if errors.Is(e, pflag.ErrHelp) { - return e - } e = fmt.Errorf("%w\nSee '%s --help'", e, c.CommandPath()) return e } diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go index ff78f93bb..1d6ba8155 100644 --- a/cmd/podman/system/prune.go +++ b/cmd/podman/system/prune.go @@ -75,6 +75,7 @@ func prune(cmd *cobra.Command, args []string) error { } } + // Remove all unused pods, containers, images, networks, and volume data. pruneOptions.Filters, err = parse.FilterArgumentsIntoFilters(filters) if err != nil { return err @@ -106,6 +107,11 @@ func prune(cmd *cobra.Command, args []string) error { if err != nil { return err } + // Print Network prune results + err = utils.PrintNetworkPruneResults(response.NetworkPruneReports, true) + if err != nil { + return err + } fmt.Printf("Total reclaimed space: %s\n", units.HumanSize((float64)(response.ReclaimedSpace))) return nil diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go index 6fd6647d0..73bb34983 100644 --- a/cmd/podman/utils/utils.go +++ b/cmd/podman/utils/utils.go @@ -84,3 +84,18 @@ func PrintImagePruneResults(imagePruneReports []*reports.PruneReport, heading bo return nil } + +func PrintNetworkPruneResults(networkPruneReport []*reports.PruneReport, heading bool) error { + var errs OutputErrors + if heading && len(networkPruneReport) > 0 { + fmt.Println("Deleted Networks") + } + for _, r := range networkPruneReport { + if r.Err == nil { + fmt.Println(r.Id) + } else { + errs = append(errs, r.Err) + } + } + return errs.PrintErrors() +} |