From dcff59d56059ce11bf4b3d6edebf412560edc879 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Tue, 7 Oct 2025 18:24:14 +0300 Subject: [PATCH] Add 'all' flag to cleanup subcommand --- src/bpm/main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bpm/main.go b/src/bpm/main.go index c725b74..3483483 100644 --- a/src/bpm/main.go +++ b/src/bpm/main.go @@ -104,6 +104,7 @@ func main() { currentFlagSet.BoolP("verbose", "v", false, "Show additional information about the current operation") currentFlagSet.BoolP("force", "f", false, "Bypass warnings during package cleanup") currentFlagSet.BoolP("yes", "y", false, "Enter 'yes' in all prompts") + currentFlagSet.BoolP("all", "a", false, "Perform all types of cleanup") currentFlagSet.BoolP("depends", "d", false, "Perform a dependency cleanup") currentFlagSet.BoolP("make-depends", "m", false, "Perform a make dependency cleanup") currentFlagSet.BoolP("compilation-files", "c", false, "Perform a cleanup of compilation files") @@ -589,6 +590,7 @@ func doCleanup() { verbose, _ := currentFlagSet.GetBool("verbose") force, _ := currentFlagSet.GetBool("force") yesAll, _ := currentFlagSet.GetBool("yes") + all, _ := currentFlagSet.GetBool("all") cleanupDepends, _ := currentFlagSet.GetBool("depends") cleanupMakeDepends, _ := currentFlagSet.GetBool("make-depends") cleanupCompilationFiles, _ := currentFlagSet.GetBool("compilation-files") @@ -596,7 +598,13 @@ func doCleanup() { cleanupFetchedPackages, _ := currentFlagSet.GetBool("fetched-packages") // Set default behaviour - if !isFlagSet(currentFlagSet, "depends") && !isFlagSet(currentFlagSet, "make-depends") && !isFlagSet(currentFlagSet, "compilation-files") && !isFlagSet(currentFlagSet, "binary-packages") && !isFlagSet(currentFlagSet, "fetched-packages") { + if all { + cleanupDepends = true + cleanupMakeDepends = bpmlib.MainBPMConfig.CleanupMakeDependencies + cleanupCompilationFiles = true + cleanupBinaryPackages = true + cleanupFetchedPackages = true + } else if !isFlagSet(currentFlagSet, "depends") && !isFlagSet(currentFlagSet, "make-depends") && !isFlagSet(currentFlagSet, "compilation-files") && !isFlagSet(currentFlagSet, "binary-packages") && !isFlagSet(currentFlagSet, "fetched-packages") { cleanupDepends = true cleanupMakeDepends = bpmlib.MainBPMConfig.CleanupMakeDependencies cleanupCompilationFiles = false