Commit 14f1c9b88a9e434b1396aef6a87812f703fd6419
1 parent
68207bdc
Using non-configurable to keep config and help out of config print
Showing
1 changed file
with
6 additions
and
3 deletions
include/CLI/App.hpp
| @@ -357,9 +357,11 @@ class App { | @@ -357,9 +357,11 @@ class App { | ||
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | // Empty name will simply remove the help flag | 359 | // Empty name will simply remove the help flag |
| 360 | - if(!name.empty()) | 360 | + if(!name.empty()) { |
| 361 | help_ptr_ = add_flag(name, description); | 361 | help_ptr_ = add_flag(name, description); |
| 362 | - | 362 | + help_ptr_->configurable(false); |
| 363 | + } | ||
| 364 | + | ||
| 363 | return help_ptr_; | 365 | return help_ptr_; |
| 364 | } | 366 | } |
| 365 | 367 | ||
| @@ -593,6 +595,7 @@ class App { | @@ -593,6 +595,7 @@ class App { | ||
| 593 | config_name_ = default_filename; | 595 | config_name_ = default_filename; |
| 594 | config_required_ = required; | 596 | config_required_ = required; |
| 595 | config_ptr_ = add_option(name, config_name_, help, !default_filename.empty()); | 597 | config_ptr_ = add_option(name, config_name_, help, !default_filename.empty()); |
| 598 | + config_ptr_->configurable(false); | ||
| 596 | } | 599 | } |
| 597 | 600 | ||
| 598 | return config_ptr_; | 601 | return config_ptr_; |
| @@ -833,7 +836,7 @@ class App { | @@ -833,7 +836,7 @@ class App { | ||
| 833 | out << name << "=" << opt->count() << std::endl; | 836 | out << name << "=" << opt->count() << std::endl; |
| 834 | 837 | ||
| 835 | // Flag, not present | 838 | // Flag, not present |
| 836 | - } else if(opt->count() == 0 && default_also && opt.get() != get_help_ptr()) { | 839 | + } else if(opt->count() == 0 && default_also) { |
| 837 | out << name << "=false" << std::endl; | 840 | out << name << "=false" << std::endl; |
| 838 | } | 841 | } |
| 839 | } | 842 | } |