summaryrefslogtreecommitdiff
path: root/cmd/podman/pods
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-01 14:08:45 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-01 17:22:51 -0400
commit3ae04f60cc98803c6155a155384079ce560c71a8 (patch)
tree927b46a1c4e95b025257eb802ce14e621ca01a2e /cmd/podman/pods
parent5d22eb02f95f28a87ed263afe28b7ff4bf2f6fee (diff)
downloadpodman-3ae04f60cc98803c6155a155384079ce560c71a8.tar.gz
podman-3ae04f60cc98803c6155a155384079ce560c71a8.tar.bz2
podman-3ae04f60cc98803c6155a155384079ce560c71a8.zip
Podman containers/pods prune should throw an error if user adds args
We are not currently checking if a user accidently adds an argument to all podman * prune commands. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/pods')
-rw-r--r--cmd/podman/pods/prune.go5
1 files changed, 2 insertions, 3 deletions
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..")