From 45bb0289b006a6a056afe9b7bc8decfe8adb3c2d Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 13 Nov 2022 19:54:30 +0100 Subject: [PATCH] App: implement option to set config key --- src/App/Application.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index ec9d32fd7c..30dc9de779 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -2140,6 +2140,7 @@ void parseProgramOptions(int ac, char ** av, const string& exe, variables_map& v ("response-file", value(),"Can be specified with '@name', too") ("dump-config", "Dumps configuration") ("get-config", value(), "Prints the value of the requested configuration key") + ("set-config", value< vector >()->multitoken(), "Sets the value of a configuration key") ("keep-deprecated-paths", "If set then config files are kept on the old location") ; @@ -2425,6 +2426,18 @@ void processProgramOptions(const variables_map& vm, std::map configKeyValue = vm["set-config"].as< std::vector >(); + for (const auto& it : configKeyValue) { + auto pos = it.find('='); + if (pos != std::string::npos) { + std::string key = it.substr(0, pos); + std::string val = it.substr(pos + 1); + mConfig[key] = val; + } + } + } } }