From 5ab0b5448265355fcd1f88dfd49bfac075afd1c9 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 30 Dec 2020 09:01:11 -0500 Subject: cmCommandLineArgument now supports OneOrMore argument type --- Source/cmCommandLineArgument.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(state)...) + ? ParseMode::Valid + : ParseMode::Invalid; + } + } } if (parseState == ParseMode::SyntaxError) { -- cgit v0.12