Skip to content
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

Counting flags #709

Merged
merged 10 commits into from
Mar 21, 2022
Merged

Counting flags #709

merged 10 commits into from
Mar 21, 2022

Conversation

phlptp
Copy link
Collaborator

@phlptp phlptp commented Feb 24, 2022

This should address #694.

There was a simple way to address #694 by adding increasingly complex enable_if discriminations with the type, but that didn't really address what I consider to be the heart of the issue, which is that flags are treated different depending on the type and that can result in unexpected behavior as was observed in this issue.

This PR starts to address it, by adding MultiOptionPolicy::Sum and a set of flag option defaults that is type dependent.

The Sum option allows any type to act as a sum operator like was done before but doing it this way allows it to act on regular options, floating point values, or strings.

By adding the capability in that way we can simplify the conditionals on the add_flag and reduce one of the overloads. (it may be possible to get rid of more now but I don't want to try that here).

@phlptp phlptp requested a review from henryiii February 24, 2022 16:28
@phlptp
Copy link
Collaborator Author

phlptp commented Mar 2, 2022

this needs to be rebased when #702 is merged

@henryiii henryiii closed this Mar 21, 2022
@henryiii henryiii reopened this Mar 21, 2022
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
@henryiii henryiii merged commit f7d26f2 into CLIUtils:main Mar 21, 2022
@henryiii henryiii deleted the counting_flags branch March 21, 2022 22:56
@github-actions github-actions bot added the needs changelog Hasn't been added to the changelog yet label Mar 21, 2022
@henryiii henryiii removed the needs changelog Hasn't been added to the changelog yet label Mar 27, 2022
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.

2 participants