diff options
author | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-17 13:02:13 +0100 |
---|---|---|
committer | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-17 13:09:48 +0100 |
commit | 82858a97c424c4822afe30668eace979aa600b85 (patch) | |
tree | 141518b1383eaf5c153b7c9a69ea712f7fa1ed81 /cmd/podman/images/prune.go | |
parent | 3d7a8cf2af43a2d315fff7b8f74ae3d039f68dd0 (diff) | |
download | podman-82858a97c424c4822afe30668eace979aa600b85.tar.gz podman-82858a97c424c4822afe30668eace979aa600b85.tar.bz2 podman-82858a97c424c4822afe30668eace979aa600b85.zip |
fix user message image prune --all
User message was the same as in the case of no flag provided.
This commit aligns message with the one used in docker.
[NO TESTS NEEDED]
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'cmd/podman/images/prune.go')
-rw-r--r-- | cmd/podman/images/prune.go | 12 |
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 +} |