Fix greediness of greedy arguments if they have sub arguments

Even sub arguments (e.g. `--help`) should be treated as values to be passed
to a nested argument parser (as documented). The sub arguments are only
added in this case to appear in the help.
This commit is contained in:
Martchus 2023-05-29 18:09:34 +02:00
parent 5bfce4235e
commit 66b6fff0f2
1 changed files with 3 additions and 0 deletions

View File

@ -361,6 +361,9 @@ bool ArgumentReader::read(ArgumentVector &args)
++parser.m_actualArgc;
lastArg = lastArgInLevel = matchingArg;
argDenotation = nullptr;
if ((values->size() < matchingArg->requiredValueCount()) && (matchingArg->flags() & Argument::Flags::Greedy)) {
continue;
}
read(lastArg->m_subArgs);
argDenotation = nullptr;
continue;