diff options
author | Toshiki Sonoda <sonoda.toshiki@fujitsu.com> | 2022-07-08 08:33:20 +0900 |
---|---|---|
committer | Toshiki Sonoda <sonoda.toshiki@fujitsu.com> | 2022-07-08 08:33:20 +0900 |
commit | d1754bdd4f299c8d92671493add4a69ef7850e1d (patch) | |
tree | c4fd3d741d641d16267aa8431c430cc095ac250e /cmd/podman/networks | |
parent | 700f1faf6e5449e13970fc17311b09e4ca9ac2c3 (diff) | |
download | podman-d1754bdd4f299c8d92671493add4a69ef7850e1d.tar.gz podman-d1754bdd4f299c8d92671493add4a69ef7850e1d.tar.bz2 podman-d1754bdd4f299c8d92671493add4a69ef7850e1d.zip |
Refactored networkPrune function
Refactored the networkPrune function to improve readability.
This commit changes the `networkPrune` function to
use the `PrintNetworkPruneResults` function.
[NO NEW TESTS NEEDED]
Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Diffstat (limited to 'cmd/podman/networks')
-rw-r--r-- | cmd/podman/networks/prune.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/cmd/podman/networks/prune.go b/cmd/podman/networks/prune.go index fa621ebac..ee5389aa7 100644 --- a/cmd/podman/networks/prune.go +++ b/cmd/podman/networks/prune.go @@ -52,10 +52,7 @@ func init() { } func networkPrune(cmd *cobra.Command, _ []string) error { - var ( - errs utils.OutputErrors - err error - ) + var err error if !force { reader := bufio.NewReader(os.Stdin) fmt.Println("WARNING! This will remove all networks not used by at least one container.") @@ -77,13 +74,5 @@ func networkPrune(cmd *cobra.Command, _ []string) error { setExitCode(err) return err } - for _, r := range responses { - if r.Error == nil { - fmt.Println(r.Name) - } else { - setExitCode(r.Error) - errs = append(errs, r.Error) - } - } - return errs.PrintErrors() + return utils.PrintNetworkPruneResults(responses, false) } |