Skip to content

Commit

Permalink
list the volumes to be deleted without forcing
Browse files Browse the repository at this point in the history
Signed-off-by: iwita <[email protected]>
  • Loading branch information
iwita committed Jan 16, 2021
1 parent 83ed464 commit 223bdb7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/podman/volumes/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func init() {
func prune(cmd *cobra.Command, args []string) error {
var (
pruneOptions = entities.VolumePruneOptions{}
listOptions = entities.VolumeListOptions{}
)
// Prompt for confirmation if --force is not set
force, err := cmd.Flags().GetBool("force")
Expand All @@ -58,7 +59,18 @@ func prune(cmd *cobra.Command, args []string) error {
}
if !force {
reader := bufio.NewReader(os.Stdin)
fmt.Println("WARNING! This will remove all volumes not used by at least one container.")
fmt.Println("WARNING! This will remove all volumes not used by at least one container. The following volumes will be removed:")
listOptions.Filter, err = filters.ParseFilterArgumentsIntoFilters(filter)
if err != nil {
return err
}
filteredVolumes, err := registry.ContainerEngine().VolumeList(context.Background(), listOptions)
if err != nil {
return err
}
for _, fv := range filteredVolumes {
fmt.Println(fv.Name)
}
fmt.Print("Are you sure you want to continue? [y/N] ")
answer, err := reader.ReadString('\n')
if err != nil {
Expand Down

0 comments on commit 223bdb7

Please sign in to comment.