CLI2: Multiple 'limit:N' args are now properly handled

- The 'next' report has 'limit:page' in the filter, and when an additional arg
  was specified, only the first was obeyed. This means that it could not be
  effectively overriden.
This commit is contained in:
Paul Beckingham 2015-09-14 07:55:51 -04:00
parent aea4e8cb11
commit 11009fd3ff

View file

@ -511,7 +511,9 @@ void CLI2::lexArguments ()
void CLI2::demotion () void CLI2::demotion ()
{ {
bool changes = false; bool changes = false;
std::vector <A2> replacement;
std::string canonical;
for (auto& a : _args) for (auto& a : _args)
{ {
if (a._lextype == Lexer::Type::tag && if (a._lextype == Lexer::Type::tag &&
@ -525,22 +527,18 @@ void CLI2::demotion ()
changes = true; changes = true;
} }
} }
}
int count = 0; else if (a._lextype == Lexer::Type::pair &&
for (auto& a : _args)
{
std::string canonical;
if (a._lextype == Lexer::Type::pair &&
canonicalize (canonical, "pseudo", a.attribute ("name"))) canonicalize (canonical, "pseudo", a.attribute ("name")))
{ {
context.config.set (canonical, a.attribute ("value")); context.config.set (canonical, a.attribute ("value"));
changes = true; changes = true;
_args.erase (_args.begin () + count);
break; // Equivalent to erasing 'a'.
continue;
} }
++count; replacement.push_back (a);
} }
if (changes && if (changes &&