Implement parse_args_internal for compound parameters

This commit is contained in:
Stephan van Veen 2019-05-18 12:22:27 +02:00
parent d95f9d9f14
commit ecf8e4fd5b

View File

@ -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;
}
}