Add option for callback with an integer value
| 5312 | |
| 5313 | /// Add option for callback with an integer value |
| 5314 | Option *add_flag_function(std::string flag_name, |
| 5315 | std::function<void(std::int64_t)> function, ///< A function to call, void(int) |
| 5316 | std::string flag_description = "") { |
| 5317 | CLI::callback_t fun = [function](const CLI::results_t &res) { |
| 5318 | std::int64_t flag_count = 0; |
| 5319 | detail::sum_flag_vector(res, flag_count); |
| 5320 | function(flag_count); |
| 5321 | return true; |
| 5322 | }; |
| 5323 | return _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)) |
| 5324 | ->multi_option_policy(MultiOptionPolicy::TakeAll); |
| 5325 | } |
| 5326 | |
| 5327 | #ifdef CLI11_CPP14 |
| 5328 | /// Add option for callback (C++14 or better only) |
nothing calls this directly
no test coverage detected