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

Policies #59

Merged
merged 3 commits into from
Nov 28, 2017
Merged

Policies #59

merged 3 commits into from
Nov 28, 2017

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Nov 28, 2017

This adds explicit policies for what to do with multiple options passed. The default is to throw if an argument is passed multiple times, but take_last, take_first, and join are all available. Take last is common in many apps. join is used (*) for git commit -m "one" -m "two".

  • Join in the git case uses two newlines instead of one like CLI11. You can always use expected(-1) and join them yourself afterwards, so custom join strings were not added.

Also, AppVeyor now is required to pass before merging, as well.

See #39 and #38. Also #48. This should behave just like the original fix, with the exception that get_take_last is no longer available and you cannot give an argument to take_last. MultiOptionPolicy::Throw remains the default (see #58), but you only have to set this once before setting up your app options and subcommands:

app.option_defaults()->take_last();

@codecov
Copy link

codecov bot commented Nov 28, 2017

Codecov Report

Merging #59 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #59   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines        1280   1296   +16     
  Branches      246    248    +2     
=====================================
+ Hits         1280   1296   +16
Impacted Files Coverage Δ
include/CLI/Option.hpp 100% <100%> (ø) ⬆️
include/CLI/App.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29b3685...63b4984. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 28, 2017

Codecov Report

Merging #59 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #59   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines        1280   1296   +16     
  Branches      246    248    +2     
=====================================
+ Hits         1280   1296   +16
Impacted Files Coverage Δ
include/CLI/Option.hpp 100% <100%> (ø) ⬆️
include/CLI/App.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29b3685...63b4984. Read the comment docs.

@henryiii henryiii merged commit 04e01d2 into master Nov 28, 2017
@henryiii henryiii deleted the policies branch November 28, 2017 20:24
@henryiii henryiii restored the policies branch November 28, 2017 20:25
@henryiii henryiii deleted the policies branch November 28, 2017 20:25
@henryiii henryiii added this to the v1.3 milestone Nov 28, 2017
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.

1 participant