mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 13:13:53 +00:00
Making positional types clearer
This commit is contained in:
parent
feaabb4fb3
commit
b459d4782d
@ -1,7 +1,7 @@
|
|||||||
## Version 0.3 (in progress)
|
## Version 0.3 (in progress)
|
||||||
|
|
||||||
* Supports GCC 4.7 again
|
* Supports GCC 4.7 again
|
||||||
* TODO: Support type and set syntax in positionals
|
* Support type and set syntax in positionals
|
||||||
* Changes `setup` for an explicit help bool in constructor/`add_subcommand`
|
* Changes `setup` for an explicit help bool in constructor/`add_subcommand`
|
||||||
|
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ public:
|
|||||||
out << "Positionals:" << std::endl;
|
out << "Positionals:" << std::endl;
|
||||||
for(const Option_p &opt : options)
|
for(const Option_p &opt : options)
|
||||||
if(opt->get_positional() && opt->has_description())
|
if(opt->get_positional() && opt->has_description())
|
||||||
detail::format_help(out, opt->get_pname(), opt->get_description(), wid);
|
detail::format_help(out, opt->help_pname(), opt->get_description(), wid);
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,6 @@ public:
|
|||||||
std::string get_pname() const {
|
std::string get_pname() const {
|
||||||
return pname;
|
return pname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Process the callback
|
/// Process the callback
|
||||||
bool run_callback() const {
|
bool run_callback() const {
|
||||||
if(_validators.size()>0) {
|
if(_validators.size()>0) {
|
||||||
@ -242,6 +241,21 @@ public:
|
|||||||
return out.str();
|
return out.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// pname with type info
|
||||||
|
std::string help_pname() const {
|
||||||
|
std::stringstream out;
|
||||||
|
out << get_pname();
|
||||||
|
if(typeval != "")
|
||||||
|
out << " " << typeval;
|
||||||
|
if(defaultval != "")
|
||||||
|
out << "=" << defaultval;
|
||||||
|
if(get_expected() > 1)
|
||||||
|
out << " x " << get_expected();
|
||||||
|
if(get_expected() == -1)
|
||||||
|
out << " ...";
|
||||||
|
return out.str();
|
||||||
|
}
|
||||||
|
|
||||||
/// Produce a flattened vector of results, vs. a vector of vectors.
|
/// Produce a flattened vector of results, vs. a vector of vectors.
|
||||||
std::vector<std::string> flatten_results() const {
|
std::vector<std::string> flatten_results() const {
|
||||||
std::vector<std::string> output;
|
std::vector<std::string> output;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user