Skip to content

Policies - #59

Merged
henryiii merged 3 commits into
masterfrom
policies
Nov 28, 2017
Merged

henryiii merged 3 commits into
masterfrom
policies

Conversation

@henryiii

@henryiii henryiii commented Nov 28, 2017 •

Copy link
Copy Markdown
Collaborator

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

codecov Bot commented Nov 28, 2017

Copy link
Copy Markdown

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

codecov Bot commented Nov 28, 2017 •

Copy link
Copy Markdown

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