Commit 5e3dc907 authored by Enrico Bothmann's avatar Enrico Bothmann Committed by Frank Siegert

Enforce that CLI args to the right take precedence

E.g. in `Sherpa LOG_FILE=1 LOG_FILE=2` the second setting would take
precedence. Note that using an option argument like `-l` always takes
precedence over the non-option form such as `LOG_FILE`.
parent 1a2630ba
......@@ -58,8 +58,8 @@ void Command_Line_Interface::Parse(int argc, char* argv[])
// parse parameters; order matters here, we want to give options precedence
// over non-options
bool success(true);
success = (ParseNoneOptions(parser) && success);
success = (ParseOptions(options) && success);
success = (ParseNoneOptions(parser) && success);
if (!success) {
......@@ -109,7 +109,7 @@ bool Command_Line_Interface::ParseNoneOptions(Option_Parser::Parser& parser)
String_Map legacysyntaxtags;
auto didfinddyamltags = false;
for (int i = 0; i < parser.nonOptionsCount(); ++i) {
for (int i {parser.nonOptionsCount()-1}; i >= 0; --i) {
auto nonOption = StringTrim(parser.nonOption(i));
// find legacy-syntax tag specifications
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment