mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 05:11:15 -06:00
cmCommandLineArgument now supports OneOrMore argument type
This commit is contained in:
committed by
Brad King
parent
b34db1db69
commit
5ab0b54482
@@ -14,6 +14,7 @@ struct cmCommandLineArgument
|
||||
One,
|
||||
Two,
|
||||
ZeroOrOne,
|
||||
OneOrMore
|
||||
};
|
||||
|
||||
std::string InvalidSyntaxMessage;
|
||||
@@ -129,6 +130,23 @@ struct cmCommandLineArgument
|
||||
: ParseMode::Invalid;
|
||||
}
|
||||
}
|
||||
} else if (this->Type == Values::OneOrMore) {
|
||||
if (input.size() == this->Name.size()) {
|
||||
auto nextValueIndex = index + 1;
|
||||
if (nextValueIndex >= allArgs.size() || allArgs[index + 1][0] == '-') {
|
||||
parseState = ParseMode::ValueError;
|
||||
} else {
|
||||
std::string buffer = allArgs[nextValueIndex++];
|
||||
while (nextValueIndex < allArgs.size() &&
|
||||
allArgs[nextValueIndex][0] != '-') {
|
||||
buffer = cmStrCat(buffer, ";", allArgs[nextValueIndex++]);
|
||||
}
|
||||
parseState =
|
||||
this->StoreCall(buffer, std::forward<CallState>(state)...)
|
||||
? ParseMode::Valid
|
||||
: ParseMode::Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parseState == ParseMode::SyntaxError) {
|
||||
|
||||
Reference in New Issue
Block a user