summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/cli.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-04-14 12:20:55 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-04-14 14:37:07 +0200
commit2fa19d98f7e4024da9dc6c9bb8f0071f966c3ae7 (patch)
tree83657ce4b5322138a5e53d90d64dc3024dd553f1 /src/other_tools/just_mr/cli.hpp
parentec4820b68c6c6957cf621f5339164ff28861ef1d (diff)
downloadjustbuild-2fa19d98f7e4024da9dc6c9bb8f0071f966c3ae7.tar.gz
just-mr support -D option
Make just-mr unconditionally support an option -D that collects a configuration overlay and forwards it to the invocation of a just subcommand that supports this option. This syntax-switching facility makes it easy to embedd dynamic parts of the configuration (like the head commit to be part of a version string) as those information can unconditionally be the first argument to just-mr.
Diffstat (limited to 'src/other_tools/just_mr/cli.hpp')
-rw-r--r--src/other_tools/just_mr/cli.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index 4e363460..1d6580da 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -44,6 +44,7 @@ struct MultiRepoCommonArguments {
std::optional<std::filesystem::path> git_path{std::nullopt};
bool norc{false};
std::size_t jobs{std::max(1U, std::thread::hardware_concurrency())};
+ std::vector<std::string> defines{};
};
struct MultiRepoLogArguments {
@@ -158,6 +159,14 @@ static inline void SetupMultiRepoCommonArguments(
clargs->jobs,
"Number of jobs to run (Default: Number of cores).")
->type_name("NUM");
+ app->add_option_function<std::string>(
+ "-D,--defines",
+ [clargs](auto const& d) { clargs->defines.emplace_back(d); },
+ "Define overlay configuration to be forwarded to the invocation of"
+ " just, in case the subcommand supports it; otherwise ignored.")
+ ->type_name("JSON")
+ ->trigger_on_parse(); // run callback on all instances while parsing,
+ // not after all parsing is done
}
static inline auto SetupMultiRepoLogArguments(