summaryrefslogtreecommitdiff
path: root/src/buildtool/common/cli.hpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-06-02 16:47:11 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-06-02 16:47:37 +0200
commite9d362faea52e39e8f51b3bb53dcc94b96841474 (patch)
tree296930a0a6e6e31586716bcf497bf87cd2129084 /src/buildtool/common/cli.hpp
parentbe2d36bb528cd31e02b08cce20629572d338e564 (diff)
downloadjustbuild-e9d362faea52e39e8f51b3bb53dcc94b96841474.tar.gz
CLI: New option -D/--defines for in-line configuration
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r--src/buildtool/common/cli.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 17ebd3f0..fdfb08b9 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -30,6 +30,7 @@ struct CommonArguments {
/// \brief Arguments required for analysing targets.
struct AnalysisArguments {
+ std::string defines{};
std::filesystem::path config_file{};
std::optional<nlohmann::json> target{};
std::optional<std::string> target_file_name{};
@@ -137,6 +138,12 @@ static inline auto SetupAnalysisArguments(
gsl::not_null<AnalysisArguments*> const& clargs,
bool with_graph = true) {
app->add_option(
+ "-D,--defines",
+ clargs->defines,
+ "Define configuration variables via an in-line JSON object.\n"
+ "Latest wins. Supersedes values provided via --config")
+ ->type_name("JSON");
+ app->add_option(
"-c,--config", clargs->config_file, "Path to configuration file.")
->type_name("PATH");
app->add_option_function<std::vector<std::string>>(