diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/common/cli.hpp | 18 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 4 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 6b6ad535..ff4db0bb 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -192,7 +192,8 @@ struct ServeArguments { }; struct GcArguments { - bool no_rotate{}; + bool no_rotate = false; + bool all = false; }; struct ToAddArguments { @@ -838,10 +839,17 @@ static inline auto SetupServeArguments( static inline void SetupGcArguments(gsl::not_null<CLI::App*> const& app, gsl::not_null<GcArguments*> const& args) { - app->add_flag("--no-rotate", - args->no_rotate, - "Do not rotate cache generations, only clean up what can be " - "done without losing cache."); + auto* no_rotate = + app->add_flag("--no-rotate", + args->no_rotate, + "Do not rotate cache generations, only clean up what can " + "be done without losing cache."); + + auto* all = app->add_flag( + "--all", args->all, "Remove all cache generations at once"); + + no_rotate->excludes(all); + all->excludes(no_rotate); } #endif // INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 8c122e6b..d13ad2e7 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -771,7 +771,9 @@ auto main(int argc, char* argv[]) -> int { } if (GarbageCollector::TriggerGarbageCollection( - *storage_config, arguments.gc.no_rotate)) { + *storage_config, + arguments.gc.no_rotate, + arguments.gc.all)) { return kExitSuccess; } return kExitBuildEnvironment; |