summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandLineArgument.h
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-12-30 14:01:11 (GMT)
committerBrad King <brad.king@kitware.com>2021-01-06 14:11:18 (GMT)
commit5ab0b5448265355fcd1f88dfd49bfac075afd1c9 (patch)
tree231b4bd557a71ea91ada7b08987516c405dd32f5 /Source/cmCommandLineArgument.h
parentb34db1db69150b4a35b8c3a692b16ebf70cda89c (diff)
downloadCMake-5ab0b5448265355fcd1f88dfd49bfac075afd1c9.zip
CMake-5ab0b5448265355fcd1f88dfd49bfac075afd1c9.tar.gz
CMake-5ab0b5448265355fcd1f88dfd49bfac075afd1c9.tar.bz2
cmCommandLineArgument now supports OneOrMore argument type
Diffstat (limited to 'Source/cmCommandLineArgument.h')
-rw-r--r--Source/cmCommandLineArgument.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/cmCommandLineArgument.h b/Source/cmCommandLineArgument.h
index 16564dd..cbedf0a 100644
--- a/Source/cmCommandLineArgument.h
+++ b/Source/cmCommandLineArgument.h
@@ -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) {