mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
util: Properly handle -noincludeconf on command line
This bug was introduced in commit
fad0867d6a.
Unit test
Co-Authored-By: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
parent
a9435e3445
commit
fa910b4765
2 changed files with 26 additions and 4 deletions
|
|
@ -365,11 +365,14 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
|
|||
m_settings.command_line_options[key].push_back(value);
|
||||
}
|
||||
|
||||
// we do not allow -includeconf from command line
|
||||
// we do not allow -includeconf from command line, only -noincludeconf
|
||||
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
|
||||
const auto& include{*util::SettingsSpan(*includes).begin()}; // pick first value as example
|
||||
error = "-includeconf cannot be used from commandline; -includeconf=" + include.write();
|
||||
return false;
|
||||
const util::SettingsSpan values{*includes};
|
||||
// Range may be empty if -noincludeconf was passed
|
||||
if (!values.empty()) {
|
||||
error = "-includeconf cannot be used from commandline; -includeconf=" + values.begin()->write();
|
||||
return false; // pick first value as example
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue