From 2037d87d34c2a94b48b148b4151c1343169a5568 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 2 Mar 2023 10:15:53 +0100 Subject: just: make -D options overlay ... instead of only honoring the latest argument. In this way, standard overlays coming from the launcher configuration can be amended in individual invocations. --- src/buildtool/common/cli.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/buildtool/common/cli.hpp') diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 865ef500..da67d8e7 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -51,7 +51,7 @@ struct LogArguments { /// \brief Arguments required for analysing targets. struct AnalysisArguments { std::optional expression_log_limit{}; - std::string defines{}; + std::vector defines{}; std::filesystem::path config_file{}; std::optional target{}; std::optional request_action_input{}; @@ -218,12 +218,14 @@ static inline auto SetupAnalysisArguments( "in error messages (Default {})", Evaluator::kDefaultExpressionLogLimit)) ->type_name("NUM"); - app->add_option( + app->add_option_function( "-D,--defines", - clargs->defines, + [clargs](auto const& d) { clargs->defines.emplace_back(d); }, "Define an overlay configuration via an in-line JSON object." - "Latest wins.") - ->type_name("JSON"); + " Multiple options overlay.") + ->type_name("JSON") + ->trigger_on_parse(); // run callback on all instances while parsing, + // not after all parsing is done app->add_option( "-c,--config", clargs->config_file, "Path to configuration file.") ->type_name("PATH"); -- cgit v1.2.3