From 0005677f3ca35f1535f4827433efcd04f3a5d731 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 26 Jan 2024 16:57:57 +0100 Subject: just-mr: add option to dump effective rc --- src/other_tools/just_mr/cli.hpp | 4 ++++ src/other_tools/just_mr/rc.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 130b7611..bcd5302a 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -46,6 +46,7 @@ struct MultiRepoCommonArguments { std::optional main{std::nullopt}; std::optional rc_path{std::nullopt}; std::optional git_path{std::nullopt}; + std::optional dump_rc{std::nullopt}; bool norc{false}; std::size_t jobs{std::max(1U, std::thread::hardware_concurrency())}; std::vector defines{}; @@ -208,6 +209,9 @@ static inline void SetupMultiRepoCommonArguments( fmt::format("Path to the git binary. (Default: {})", kDefaultGitPath)) ->type_name("PATH"); + app->add_option( + "--dump-rc", clargs->dump_rc, "Dump the effective rc value.") + ->type_name("PATH"); app->add_flag("--norc", clargs->norc, "Do not use any just-mrrc file."); app->add_option("-j, --jobs", clargs->jobs, diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 320efca7..209e4be6 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -225,6 +225,14 @@ namespace { } } + // If requested, dump effective rc + if (clargs->common.dump_rc) { + auto dump_json = rc_config.ToJson(); + dump_json.erase("rc files"); + std::ofstream os(*clargs->common.dump_rc); + os << dump_json.dump(2) << std::endl; + } + // read local build root; overwritten if user provided it already if (not clargs->common.just_mr_paths->root) { auto build_root = -- cgit v1.2.3