aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-17 17:56:32 -0700
committerGitHub <noreply@github.com>2021-03-17 17:56:32 -0700
commit6f6cc1cce66709f569fbd8fafc9ed5425120bc41 (patch)
treed2e86ab86498c77026c14c1d71f765c8e7537d74
parentb819f140016b239249287e73600f18ab78051d41 (diff)
parent82858a97c424c4822afe30668eace979aa600b85 (diff)
downloadpodman-6f6cc1cce66709f569fbd8fafc9ed5425120bc41.tar.gz
podman-6f6cc1cce66709f569fbd8fafc9ed5425120bc41.tar.bz2
podman-6f6cc1cce66709f569fbd8fafc9ed5425120bc41.zip
Merge pull request #9736 from jmguzik/fix-image-prune-cmd-message
fix user message image prune --all
-rw-r--r--cmd/podman/images/prune.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index 78e107a97..8231e5c57 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -53,9 +53,7 @@ func init() {
func prune(cmd *cobra.Command, args []string) error {
if !force {
reader := bufio.NewReader(os.Stdin)
- fmt.Printf(`
-WARNING! This will remove all dangling images.
-Are you sure you want to continue? [y/N] `)
+ fmt.Printf("%s", createPruneWarningMessage(pruneOpts))
answer, err := reader.ReadString('\n')
if err != nil {
return err
@@ -72,3 +70,11 @@ Are you sure you want to continue? [y/N] `)
return utils.PrintImagePruneResults(results, false)
}
+
+func createPruneWarningMessage(pruneOpts entities.ImagePruneOptions) string {
+ question := "Are you sure you want to continue? [y/N] "
+ if pruneOpts.All {
+ return "WARNING! This will remove all images without at least one container associated to them.\n" + question
+ }
+ return "WARNING! This will remove all dangling images.\n" + question
+}