mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-02 05:33:53 +00:00
Rename typeval to type_name to match API
This commit is contained in:
parent
ac0205d01d
commit
f785046da6
@ -17,7 +17,7 @@ Changes to the help system (most normal users will not notice this):
|
|||||||
* Protected function `_has_help_positional` removed
|
* Protected function `_has_help_positional` removed
|
||||||
* `format_help` can now be chained
|
* `format_help` can now be chained
|
||||||
|
|
||||||
Validators are now much more powerful [#118], all build in validators upgraded to the new form:
|
Validators are now much more powerful [#118], all built in validators upgraded to the new form:
|
||||||
|
|
||||||
* A subclass of `CLI::Validator` is now also accepted.
|
* A subclass of `CLI::Validator` is now also accepted.
|
||||||
* They now can set the type name to things like `PATH` and `INT in [1-4]`.
|
* They now can set the type name to things like `PATH` and `INT in [1-4]`.
|
||||||
|
@ -171,7 +171,9 @@ class Option : public OptionBase<Option> {
|
|||||||
std::string defaultval_;
|
std::string defaultval_;
|
||||||
|
|
||||||
/// A human readable type value, set when App creates this
|
/// A human readable type value, set when App creates this
|
||||||
std::function<std::string()> typeval_;
|
///
|
||||||
|
/// This is a lambda function so "types" can be dynamic, such as when a set prints its contents.
|
||||||
|
std::function<std::string()> type_name_;
|
||||||
|
|
||||||
/// True if this option has a default
|
/// True if this option has a default
|
||||||
bool default_{false};
|
bool default_{false};
|
||||||
@ -635,10 +637,10 @@ class Option : public OptionBase<Option> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set the type function to run when displayed on this option
|
/// Set the type function to run when displayed on this option
|
||||||
void set_type_name_fn(std::function<std::string()> typefun) { typeval_ = typefun; }
|
void set_type_name_fn(std::function<std::string()> typefun) { type_name_ = typefun; }
|
||||||
|
|
||||||
/// Get the typename for this option
|
/// Get the typename for this option
|
||||||
std::string get_type_name() const { return typeval_(); }
|
std::string get_type_name() const { return type_name_(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CLI
|
} // namespace CLI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user