diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 13 | ||||
-rw-r--r-- | src/other_tools/just_mr/main.cpp | 10 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 0c3e63a9..96f7cba2 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -85,6 +85,10 @@ struct MultiRepoUpdateArguments { std::vector<std::string> repos_to_update; }; +struct MultiRepoGcArguments { + bool drop_only{false}; +}; + struct MultiRepoJustSubCmdsArguments { std::optional<std::string> subcmd_name{std::nullopt}; std::vector<std::string> additional_just_args; @@ -124,6 +128,7 @@ struct CommandLineArguments { MultiRepoSetupArguments setup; MultiRepoFetchArguments fetch; MultiRepoUpdateArguments update; + MultiRepoGcArguments gc; MultiRepoJustSubCmdsArguments just_cmd; MultiRepoRemoteAuthArguments auth; ForwardOnlyArguments launch_fwd; @@ -338,6 +343,14 @@ static inline void SetupMultiRepoUpdateArguments( ->type_name(""); } +static inline void SetupMultiRepoGcArguments( + gsl::not_null<CLI::App*> const& app, + gsl::not_null<MultiRepoGcArguments*> const& clargs) { + app->add_flag("--drop-only", + clargs->drop_only, + "Only drop old repository generations"); +} + static inline auto SetupMultiRepoRemoteAuthArguments( gsl::not_null<CLI::App*> const& app, gsl::not_null<MultiRepoRemoteAuthArguments*> const& authargs) { diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 28d4669f..d65cbb50 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -82,6 +82,13 @@ void SetupUpdateCommandArguments( SetupMultiRepoUpdateArguments(app, &clargs->update); } +/// \brief Setup arguments for subcommand "just-mr gc-repo". +void SetupUpdateGcArguments( + gsl::not_null<CLI::App*> const& app, + gsl::not_null<CommandLineArguments*> const& clargs) { + SetupMultiRepoGcArguments(app, &clargs->gc); +} + /// \brief Setup arguments for subcommand "just-mr setup" and /// "just-mr setup-env". void SetupSetupCommandArguments( @@ -133,6 +140,7 @@ void SetupSetupCommandArguments( SetupSetupCommandArguments(cmd_setup_env, &clargs); SetupFetchCommandArguments(cmd_fetch, &clargs); SetupUpdateCommandArguments(cmd_update, &clargs); + SetupUpdateGcArguments(cmd_gc_repo, &clargs); // for 'just' calls, allow extra arguments cmd_do->allow_extras(); @@ -336,7 +344,7 @@ auto main(int argc, char* argv[]) -> int { if (arguments.cmd == SubCommand::kGcRepo) { return RepositoryGarbageCollector::TriggerGarbageCollection( - *native_storage_config) + *native_storage_config, arguments.gc.drop_only) ? kExitSuccess : kExitBuiltinCommandFailure; } |