mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
Implement parse_args_internal for compound parameters
This commit is contained in:
parent
d95f9d9f14
commit
ecf8e4fd5b
@ -451,7 +451,20 @@ class ArgumentParser {
|
||||
auto tArgument = tIterator->second;
|
||||
it = tArgument->consume(std::next(it), end, tCurrentArgument);
|
||||
}
|
||||
else { // TODO: compound optional arguments
|
||||
else if (const auto& tCompoundArgument = tCurrentArgument;
|
||||
tCompoundArgument.size() > 1 &&
|
||||
tCompoundArgument[0] == '-' &&
|
||||
tCompoundArgument[1] != '-') {
|
||||
++it;
|
||||
for (size_t j = 1; j < tCompoundArgument.size(); j++) {
|
||||
auto tCurrentArgument = std::string{'-', tCompoundArgument[j]};
|
||||
if (auto tIterator = mArgumentMap.find(tCurrentArgument); tIterator != mArgumentMap.end()) {
|
||||
auto tArgument = tIterator->second;
|
||||
it = tArgument->consume(it, end, tCurrentArgument);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user