diff options
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 8 | ||||
-rw-r--r-- | src/other_tools/just_mr/rc.cpp | 28 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 96f7cba2..44acc1f5 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -89,6 +89,13 @@ struct MultiRepoGcArguments { bool drop_only{false}; }; +// Arguments for invocation logging; set only via rc files +struct InvocationLogArguments { + std::optional<std::filesystem::path> directory{std::nullopt}; + std::optional<std::string> project_id{std::nullopt}; + std::optional<std::string> metadata{std::nullopt}; +}; + struct MultiRepoJustSubCmdsArguments { std::optional<std::string> subcmd_name{std::nullopt}; std::vector<std::string> additional_just_args; @@ -132,6 +139,7 @@ struct CommandLineArguments { MultiRepoJustSubCmdsArguments just_cmd; MultiRepoRemoteAuthArguments auth; ForwardOnlyArguments launch_fwd; + InvocationLogArguments invocation_log; }; static inline void SetupMultiRepoCommonArguments( diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 0359253c..401510f9 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -584,6 +584,34 @@ namespace { } } } + // read invocation log argumnets + auto invocation_log = rc_config["invocation log"]; + if (invocation_log.IsNotNull()) { + if (not invocation_log->IsMap()) { + Logger::Log( + LogLevel::Error, + "Value of \"invocation log\" has to be a map, but found {}", + invocation_log->ToString()); + std::exit(kExitConfigError); + } + auto dir = + ReadLocation(invocation_log->Get("directory", Expression::none_t{}), + clargs->common.just_mr_paths->workspace_root); + if (dir) { + clargs->invocation_log.directory = dir->first; + // Parse the remaining entries, only if directory is specified + auto proj_id = + invocation_log->Get("project id", Expression::none_t{}); + if (proj_id->IsString()) { + clargs->invocation_log.project_id = proj_id->String(); + } + auto metadata = + invocation_log->Get("metadata", Expression::none_t{}); + if (metadata->IsString()) { + clargs->invocation_log.metadata = metadata->String(); + } + } + } // read config lookup order auto config_lookup_order = rc_config["config lookup order"]; if (config_lookup_order.IsNotNull()) { |