summaryrefslogtreecommitdiff
path: root/Source/cmCommandLineArgument.h
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-12-30 09:01:11 -0500
committerBrad King <brad.king@kitware.com>2021-01-06 09:11:18 -0500
commit5ab0b5448265355fcd1f88dfd49bfac075afd1c9 (patch)
tree231b4bd557a71ea91ada7b08987516c405dd32f5 /Source/cmCommandLineArgument.h
parentb34db1db69150b4a35b8c3a692b16ebf70cda89c (diff)
downloadcmake-5ab0b5448265355fcd1f88dfd49bfac075afd1c9.tar.gz
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 16564ddb43..cbedf0a9c0 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) {