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:
parent
5bfce4235e
commit
66b6fff0f2
|
@ -361,6 +361,9 @@ bool ArgumentReader::read(ArgumentVector &args)
|
||||||
++parser.m_actualArgc;
|
++parser.m_actualArgc;
|
||||||
lastArg = lastArgInLevel = matchingArg;
|
lastArg = lastArgInLevel = matchingArg;
|
||||||
argDenotation = nullptr;
|
argDenotation = nullptr;
|
||||||
|
if ((values->size() < matchingArg->requiredValueCount()) && (matchingArg->flags() & Argument::Flags::Greedy)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
read(lastArg->m_subArgs);
|
read(lastArg->m_subArgs);
|
||||||
argDenotation = nullptr;
|
argDenotation = nullptr;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue