Skip to content

Counting flags - #709

Merged
henryiii merged 10 commits into
CLIUtils:mainfrom
phlptp:counting_flags
Mar 21, 2022
Merged

henryiii merged 10 commits into
CLIUtils:mainfrom
phlptp:counting_flags

Conversation

@phlptp

@phlptp phlptp commented Feb 24, 2022

Copy link
Copy Markdown
Collaborator

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

phlptp commented Mar 2, 2022

Copy link
Copy Markdown
Collaborator Author

this needs to be rebased when #702 is merged

@henryiii henryiii closed this Mar 21, 2022
@henryiii henryiii reopened this Mar 21, 2022
Comment thread README.md Resolved
Comment thread book/chapters/options.md Resolved
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