Skip to content

pair/tuple defaults #1081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 9, 2024
Merged

pair/tuple defaults #1081

merged 10 commits into from
Nov 9, 2024

Conversation

phlptp
Copy link
Collaborator

@phlptp phlptp commented Nov 5, 2024

add capability to accept pair/tuple default values and a little cleaner parsing in some cases

Fixes #711

@@ -307,6 +307,30 @@ template <typename S> class is_tuple_like {
static constexpr bool value = decltype(test<S>(0))::value;
};

/// This will only trigger for actual void type
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code moved to get thing in the right order

result.back() == ']') { // this is now a vector string likely from the default or user entry
result.pop_back();

for(auto &var : CLI::detail::split(result.substr(1), ',')) {
for(auto &var : CLI::detail::split_up(result.substr(1), ',')) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't handling sub vectors properly

@phlptp phlptp requested a review from henryiii November 7, 2024 16:48
@phlptp
Copy link
Collaborator Author

phlptp commented Nov 7, 2024

@henryiii FYI, no api changes here, Mainly getting the default_val on parity with the types the options support themselves. Also cleaned up a few methods. Was a bug that came up a while ago and hadn't got around to fixing until now. I will merge in a few days

@phlptp phlptp merged commit af270ce into main Nov 9, 2024
53 checks passed
@phlptp phlptp deleted the pair_defaults branch November 9, 2024 15:57
@phlptp phlptp mentioned this pull request Nov 16, 2024
phlptp added a commit that referenced this pull request Nov 18, 2024
Fixes issue #1086.

In the default_val enums of uint8_t would read in as a string as they
could be converted to a string. This worked ok for normal values, but
when a check was added for specific strings, it caused an error when the
default_val was added. This PR fixes the issue.

The builder for coverage was updated to CMake 3.31 (by github), this
triggered an error in the coverage tool script. This led to updating
that script, which led to uncovering some missing coverage, which led to
additional tests, which led to some issues around single element tuples
support from #1081, which led to a few other issues that came up in the
to_string operation and templates.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

default value for std::pair
1 participant