summaryrefslogtreecommitdiff
path: root/src/buildtool/common/cli.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-03-02 10:15:53 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-03-02 12:05:58 +0100
commit2037d87d34c2a94b48b148b4151c1343169a5568 (patch)
tree069796685b7d7a5ef9467dffe0e4b423e47ce1a4 /src/buildtool/common/cli.hpp
parentfa0ec67e09959ff15363bab8d6be95fe45ec8fb6 (diff)
downloadjustbuild-2037d87d34c2a94b48b148b4151c1343169a5568.tar.gz
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.
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r--src/buildtool/common/cli.hpp12
1 files changed, 7 insertions, 5 deletions
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<std::size_t> expression_log_limit{};
- std::string defines{};
+ std::vector<std::string> defines{};
std::filesystem::path config_file{};
std::optional<nlohmann::json> target{};
std::optional<std::string> 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<std::string>(
"-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");