summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorKunal Kushwaha <kunal.kushwaha@gmail.com>2019-11-28 11:45:26 +0900
committerKunal Kushwaha <kunal.kushwaha@gmail.com>2019-11-28 11:45:26 +0900
commit0602ce4dc04ec1b78724019e03066b8562877b73 (patch)
treecd0df8dbdf0025bea9cdd283d0e9298c2f65d0f5 /cmd/podman
parent2178875fa7975f00a4da15fef9809cd3fb74feba (diff)
downloadpodman-0602ce4dc04ec1b78724019e03066b8562877b73.tar.gz
podman-0602ce4dc04ec1b78724019e03066b8562877b73.tar.bz2
podman-0602ce4dc04ec1b78724019e03066b8562877b73.zip
command output fixed as per docker equivalent
container prune command ask for confirmation by default. Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/containers_prune.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/podman/containers_prune.go b/cmd/podman/containers_prune.go
index 3d0fef37d..e18c829e0 100644
--- a/cmd/podman/containers_prune.go
+++ b/cmd/podman/containers_prune.go
@@ -1,6 +1,11 @@
package main
import (
+ "bufio"
+ "fmt"
+ "os"
+ "strings"
+
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod/define"
@@ -39,6 +44,19 @@ func init() {
}
func pruneContainersCmd(c *cliconfig.PruneContainersValues) error {
+ if !c.Force {
+ reader := bufio.NewReader(os.Stdin)
+ fmt.Printf(`WARNING! This will remove all stopped containers.
+Are you sure you want to continue? [y/N] `)
+ ans, err := reader.ReadString('\n')
+ if err != nil {
+ return errors.Wrapf(err, "error reading input")
+ }
+ if strings.ToLower(ans)[0] != 'y' {
+ return nil
+ }
+ }
+
runtime, err := adapter.GetRuntime(getContext(), &c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")