Commit f785046da65aa5b99923c10645d42cc00b1626c1

Authored by Henry Fredrick Schreiner
1 parent ac0205d0

Rename typeval to type_name to match API

CHANGELOG.md
... ... @@ -17,7 +17,7 @@ Changes to the help system (most normal users will not notice this):
17 17 * Protected function `_has_help_positional` removed
18 18 * `format_help` can now be chained
19 19  
20   -Validators are now much more powerful [#118], all build in validators upgraded to the new form:
  20 +Validators are now much more powerful [#118], all built in validators upgraded to the new form:
21 21  
22 22 * A subclass of `CLI::Validator` is now also accepted.
23 23 * They now can set the type name to things like `PATH` and `INT in [1-4]`.
... ...
include/CLI/Option.hpp
... ... @@ -171,7 +171,9 @@ class Option : public OptionBase<Option> {
171 171 std::string defaultval_;
172 172  
173 173 /// A human readable type value, set when App creates this
174   - std::function<std::string()> typeval_;
  174 + ///
  175 + /// This is a lambda function so "types" can be dynamic, such as when a set prints its contents.
  176 + std::function<std::string()> type_name_;
175 177  
176 178 /// True if this option has a default
177 179 bool default_{false};
... ... @@ -635,10 +637,10 @@ class Option : public OptionBase&lt;Option&gt; {
635 637 }
636 638  
637 639 /// Set the type function to run when displayed on this option
638   - void set_type_name_fn(std::function<std::string()> typefun) { typeval_ = typefun; }
  640 + void set_type_name_fn(std::function<std::string()> typefun) { type_name_ = typefun; }
639 641  
640 642 /// Get the typename for this option
641   - std::string get_type_name() const { return typeval_(); }
  643 + std::string get_type_name() const { return type_name_(); }
642 644 };
643 645  
644 646 } // namespace CLI
... ...