mirror of
https://github.com/containers/podman.git
synced 2025-06-26 21:07:02 +08:00
Merge pull request #9736 from jmguzik/fix-image-prune-cmd-message
fix user message image prune --all
This commit is contained in:
@ -53,9 +53,7 @@ func init() {
|
|||||||
func prune(cmd *cobra.Command, args []string) error {
|
func prune(cmd *cobra.Command, args []string) error {
|
||||||
if !force {
|
if !force {
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
fmt.Printf(`
|
fmt.Printf("%s", createPruneWarningMessage(pruneOpts))
|
||||||
WARNING! This will remove all dangling images.
|
|
||||||
Are you sure you want to continue? [y/N] `)
|
|
||||||
answer, err := reader.ReadString('\n')
|
answer, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -72,3 +70,11 @@ Are you sure you want to continue? [y/N] `)
|
|||||||
|
|
||||||
return utils.PrintImagePruneResults(results, false)
|
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
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user