summaryrefslogtreecommitdiffstats
path: root/Source/cmArgumentParser.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmArgumentParser: Ignore positional after keywordMatthew Woehlke2022-08-171-4/+7
| | | | | | | | | Tweak cmArgumentParser to ignore positional arguments once a keyword argument has been seen. This prevents mingling of keyword arguments being able to effectively skip positional arguments, with later arguments being picked up again; this seems highly likely to lead to user confusion. This is also consistent with how other languages (e.g. Python) handle a mix of "named" and positional arguments.
* cmArgumentParser: Model non-empty strings with wrapper typeBrad King2022-07-281-0/+14
| | | | | | Some clients have been explicitly checking whether the string specified after a keyword is empty. Offer them a way to specify that the string must be non-empty as part of the binding type.
* cmArgumentParser: Offer bindings for positional argumentsBrad King2022-07-271-1/+26
|
* cmArgumentParser: Generalize expected argument countBrad King2022-07-271-31/+37
| | | | Replace the boolean expectation with an integer count.
* cmArgumentParser: Generalize internal state trackingBrad King2022-07-271-22/+43
| | | | Use a `std::function` to support general actions on value arguments.
* cmArgumentParser: Drop unused parsedKeywords argument to Parse()Brad King2022-07-251-3/+0
| | | | All clients have been ported to use a binding instead.
* cmArgumentParser: Offer binding for list of parsed keywordsBrad King2022-07-251-0/+3
| | | | | Some clients ask for this list in their `Parse()` call. Offer them a way to express this request as a binding.
* cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()Brad King2022-07-251-3/+0
| | | | | All clients have been converted to encoding this requirement in their bindings.
* cmArgumentParser: Offer private binding to cmParseArgumentsCommandBrad King2022-07-251-0/+3
| | | | | | | | The `keywordsMissingValue` argument to `Parse()` is now needed only for the `cmake_parse_arguments` result `_KEYWORDS_MISSING_VALUES`. Offer its implementation a private binding for this. Our internal clients can use `ArgumentParser::NonEmpty<>` and friends to enforce the presence of values.
* cmArgumentParser: Capture keyword errors in parse resultsBrad King2022-07-221-0/+20
| | | | | | | | | Since commit f46b2e9142 (cmArgumentParser: Model maybe-missing string with wrapper type, 2022-07-06) we know during parsing whether or not it is an error for a keyword to be missing a value. Record such errors in the parse results structure. Offer clients a helper method to report them. This provides clients with an alternative to manually checking `keywordsMissingValue` and generating their own error message.
* cmArgumentParser: Store keyword action map with explicit nameBrad King2022-07-221-4/+4
|
* cmArgumentParser: Track pending keyword explicitlyBrad King2022-07-201-5/+11
| | | | Avoid allocating missing keyword vector unnecessarily.
* cmArgumentParser: Simplify internal method signaturesBrad King2022-07-201-13/+10
| | | | | Record `Parse` parameters during construction of the internal instance instead of passing them to every method.
* cmArgumentParser: Model maybe-missing string with wrapper typeBrad King2022-07-071-0/+7
| | | | | | Bindings to `std::string` require one value. Some clients have been filtering `keywordsMissingValue` to support keywords that tolerate a missing value. Offer them a type-safe way to achieve this instead.
* cmArgumentParser: Model maybe-empty and non-empty lists with wrapper typesBrad King2022-07-071-1/+10
| | | | | | | | Previously bindings to `std::vector<std::string>` required at least one value. Some clients have been filtering `keywordsMissingValue` to support keywords followed by empty lists. Instead, require clients to specify whether a keyword's list can be empty as part of the binding type.
* cmArgumentParser: Remove unnecessary local names for common typesBrad King2022-07-051-2/+2
|
* cmArgumentParser: Avoid allocating copies of keyword stringsBrad King2022-07-051-4/+4
|
* IWYU: add a mapping for other `__decay_and_strip` instancesBen Boeckel2020-04-291-1/+0
|
* cmArgumentParser: Record parsed keywordsRegina Pfeifer2019-09-201-1/+5
|
* cmArgumentParser: Fix -Wcomma warningBrad King2019-04-111-1/+1
| | | | | | | | | | | | | Clang `-Wcomma` warns: ``` Source/cmArgumentParser.cxx:58:42: warning: possible misuse of comma operator this->CurrentList = (val.emplace_back(), &val.back()); ^ ``` This was introduced by commit 4359fe133b (Introduce cmArgumentParser, 2019-03-23). Suppress it with the suggested cast.
* Introduce cmArgumentParserRegina Pfeifer2019-04-041-0/+93