mirror of https://github.com/containers/podman.git
Merge pull request #7874 from rhatdan/volume
Podman containers/pods prune should throw an error if user adds args
This commit is contained in:
commit
a88f404fe1
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
"github.com/containers/podman/v2/cmd/podman/registry"
|
"github.com/containers/podman/v2/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v2/cmd/podman/utils"
|
"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/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -25,6 +26,7 @@ var (
|
||||||
Long: pruneDescription,
|
Long: pruneDescription,
|
||||||
RunE: prune,
|
RunE: prune,
|
||||||
Example: `podman container prune`,
|
Example: `podman container prune`,
|
||||||
|
Args: validate.NoArgs,
|
||||||
}
|
}
|
||||||
force bool
|
force bool
|
||||||
filter = []string{}
|
filter = []string{}
|
||||||
|
|
@ -45,9 +47,6 @@ func prune(cmd *cobra.Command, args []string) error {
|
||||||
var (
|
var (
|
||||||
pruneOptions = entities.ContainerPruneOptions{}
|
pruneOptions = entities.ContainerPruneOptions{}
|
||||||
)
|
)
|
||||||
if len(args) > 0 {
|
|
||||||
return errors.Errorf("`%s` takes no arguments", cmd.CommandPath())
|
|
||||||
}
|
|
||||||
if !force {
|
if !force {
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
fmt.Println("WARNING! This will remove all non running containers.")
|
fmt.Println("WARNING! This will remove all non running containers.")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/containers/podman/v2/cmd/podman/registry"
|
"github.com/containers/podman/v2/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v2/cmd/podman/utils"
|
"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/containers/podman/v2/pkg/domain/entities"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
@ -23,6 +24,7 @@ var (
|
||||||
|
|
||||||
pruneCommand = &cobra.Command{
|
pruneCommand = &cobra.Command{
|
||||||
Use: "prune [flags]",
|
Use: "prune [flags]",
|
||||||
|
Args: validate.NoArgs,
|
||||||
Short: "Remove all stopped pods and their containers",
|
Short: "Remove all stopped pods and their containers",
|
||||||
Long: pruneDescription,
|
Long: pruneDescription,
|
||||||
RunE: prune,
|
RunE: prune,
|
||||||
|
|
@ -41,9 +43,6 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func prune(cmd *cobra.Command, args []string) error {
|
func prune(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) > 0 {
|
|
||||||
return errors.Errorf("`%s` takes no arguments", cmd.CommandPath())
|
|
||||||
}
|
|
||||||
if !pruneOptions.Force {
|
if !pruneOptions.Force {
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
fmt.Println("WARNING! This will remove all stopped/exited pods..")
|
fmt.Println("WARNING! This will remove all stopped/exited pods..")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue