summaryrefslogtreecommitdiff
path: root/cmd/podman/utils/utils.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-12-04 14:06:52 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2020-12-09 06:17:28 -0500
commita59e2a1a114c039e1780aa2b08b9452dc569cdf4 (patch)
tree1e40d530bd96ef9e4609383788175852465c49b8 /cmd/podman/utils/utils.go
parentdd295f297b6dd51d22c64c75f4ef4f80f953bbde (diff)
downloadpodman-a59e2a1a114c039e1780aa2b08b9452dc569cdf4.tar.gz
podman-a59e2a1a114c039e1780aa2b08b9452dc569cdf4.tar.bz2
podman-a59e2a1a114c039e1780aa2b08b9452dc569cdf4.zip
Repeat system pruning until there is nothing removed
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/utils/utils.go')
-rw-r--r--cmd/podman/utils/utils.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go
index 1c9e4d786..2ca2c4c92 100644
--- a/cmd/podman/utils/utils.go
+++ b/cmd/podman/utils/utils.go
@@ -26,8 +26,11 @@ func FileExists(path string) bool {
return !file.IsDir()
}
-func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport) error {
+func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport, heading bool) error {
var errs OutputErrors
+ if heading && len(podPruneReports) > 0 {
+ fmt.Println("Deleted Pods")
+ }
for _, r := range podPruneReports {
if r.Err == nil {
fmt.Println(r.Id)
@@ -38,8 +41,11 @@ func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport) error {
return errs.PrintErrors()
}
-func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneReport) error {
+func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneReport, heading bool) error {
var errs OutputErrors
+ if heading && (len(containerPruneReport.ID) > 0 || len(containerPruneReport.Err) > 0) {
+ fmt.Println("Deleted Containers")
+ }
for k := range containerPruneReport.ID {
fmt.Println(k)
}
@@ -49,8 +55,11 @@ func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneRep
return errs.PrintErrors()
}
-func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport) error {
+func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport, heading bool) error {
var errs OutputErrors
+ if heading && len(volumePruneReport) > 0 {
+ fmt.Println("Deleted Volumes")
+ }
for _, r := range volumePruneReport {
if r.Err == nil {
fmt.Println(r.Id)
@@ -61,7 +70,10 @@ func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport) er
return errs.PrintErrors()
}
-func PrintImagePruneResults(imagePruneReport *entities.ImagePruneReport) error {
+func PrintImagePruneResults(imagePruneReport *entities.ImagePruneReport, heading bool) error {
+ if heading && (len(imagePruneReport.Report.Id) > 0 || len(imagePruneReport.Report.Err) > 0) {
+ fmt.Println("Deleted Images")
+ }
for _, i := range imagePruneReport.Report.Id {
fmt.Println(i)
}