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

Adding simple flag callback #33

Merged
merged 5 commits into from
Sep 11, 2017
Merged

Adding simple flag callback #33

merged 5 commits into from
Sep 11, 2017

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Sep 10, 2017

This should fix #32 in a general way, I think.

.add_flag_functional("--name", [](size_t count){...});

C++14 shortcut:

.add_flag("--name", [](size_t count){...});

This can't be added to C++11 since the compiler can't tell the difference between std::string and std::function<void(size_t)> for a const char * argument until C++14 (or C++11 mode on a C++14 compiler, since this was back-fixed as a bug, but that's too specific to provide #if's for).

@henryiii henryiii changed the title Addind simple flag callback Adding simple flag callback Sep 10, 2017
@codecov
Copy link

codecov bot commented Sep 11, 2017

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #33   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines        1121   1141   +20     
  Branches      231    233    +2     
=====================================
+ Hits         1121   1141   +20
Impacted Files Coverage Δ
include/CLI/Timer.hpp 100% <ø> (ø) ⬆️
include/CLI/App.hpp 100% <100%> (ø) ⬆️
include/CLI/Validators.hpp 100% <0%> (ø) ⬆️

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 adbd2aa...636795d. Read the comment docs.

@infinity0n3
Copy link

I can confirm that it works now. Would have been nicer to have the add_flag syntax but I have to use c++11.
Good thing is that it's a one liner now.

Thank you!

@henryiii henryiii merged commit 37667f5 into master Sep 11, 2017
@henryiii henryiii deleted the flagcb branch September 11, 2017 15:45
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.

Version flag/option
2 participants