diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-01 19:35:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 19:35:31 -0400 |
commit | a88f404fe132020d1572a9eee0f0492f941f6ec8 (patch) | |
tree | a519d54e64d507fe4d5d9aaf40b6a70044d06b7e /cmd/podman | |
parent | 6d8339709f05eae5df1eeb8c688fc44405a600ed (diff) | |
parent | 3ae04f60cc98803c6155a155384079ce560c71a8 (diff) | |
download | podman-a88f404fe132020d1572a9eee0f0492f941f6ec8.tar.gz podman-a88f404fe132020d1572a9eee0f0492f941f6ec8.tar.bz2 podman-a88f404fe132020d1572a9eee0f0492f941f6ec8.zip |
Merge pull request #7874 from rhatdan/volume
Podman containers/pods prune should throw an error if user adds args
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/prune.go | 5 | ||||
-rw-r--r-- | cmd/podman/pods/prune.go | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/cmd/podman/containers/prune.go b/cmd/podman/containers/prune.go index 90dea2b45..cfe6765ac 100644 --- a/cmd/podman/containers/prune.go +++ b/cmd/podman/containers/prune.go @@ -10,6 +10,7 @@ import ( "github.com/containers/podman/v2/cmd/podman/registry" "github.com/containers/podman/v2/cmd/podman/utils" + "github.com/containers/podman/v2/cmd/podman/validate" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -25,6 +26,7 @@ var ( Long: pruneDescription, RunE: prune, Example: `podman container prune`, + Args: validate.NoArgs, } force bool filter = []string{} @@ -45,9 +47,6 @@ func prune(cmd *cobra.Command, args []string) error { var ( pruneOptions = entities.ContainerPruneOptions{} ) - if len(args) > 0 { - return errors.Errorf("`%s` takes no arguments", cmd.CommandPath()) - } if !force { reader := bufio.NewReader(os.Stdin) fmt.Println("WARNING! This will remove all non running containers.") diff --git a/cmd/podman/pods/prune.go b/cmd/podman/pods/prune.go index a7347ede5..f13d95ae9 100644 --- a/cmd/podman/pods/prune.go +++ b/cmd/podman/pods/prune.go @@ -9,6 +9,7 @@ import ( "github.com/containers/podman/v2/cmd/podman/registry" "github.com/containers/podman/v2/cmd/podman/utils" + "github.com/containers/podman/v2/cmd/podman/validate" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -23,6 +24,7 @@ var ( pruneCommand = &cobra.Command{ Use: "prune [flags]", + Args: validate.NoArgs, Short: "Remove all stopped pods and their containers", Long: pruneDescription, RunE: prune, @@ -41,9 +43,6 @@ func init() { } func prune(cmd *cobra.Command, args []string) error { - if len(args) > 0 { - return errors.Errorf("`%s` takes no arguments", cmd.CommandPath()) - } if !pruneOptions.Force { reader := bufio.NewReader(os.Stdin) fmt.Println("WARNING! This will remove all stopped/exited pods..") |