mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-30 20:53:52 +00:00
removing added pname from helpstring for optional
This commit is contained in:
parent
9b31ef38d8
commit
cf667f28a9
@ -159,10 +159,10 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Gets a , sep list of names. Does not include the positional name.
|
||||
std::string get_name() const {
|
||||
/// Gets a , sep list of names. Does not include the positional name if opt_only=true.
|
||||
std::string get_name(bool opt_only=false) const {
|
||||
std::vector<std::string> name_list;
|
||||
if(pname.length() > 0)
|
||||
if(!opt_only && pname.length() > 0)
|
||||
name_list.push_back(pname);
|
||||
for(const std::string& sname : snames)
|
||||
name_list.push_back("-"+sname);
|
||||
@ -212,24 +212,10 @@ public:
|
||||
return out;
|
||||
}
|
||||
|
||||
/// Diagnostic representation
|
||||
std::string string() const {
|
||||
std::string val = "Option: " + get_name() + "\n"
|
||||
+ " " + description + "\n"
|
||||
+ " [";
|
||||
for(const auto& item : results) {
|
||||
if(&item!=&results[0])
|
||||
val+="],[";
|
||||
val += detail::join(item);
|
||||
}
|
||||
val += "]";
|
||||
return val;
|
||||
}
|
||||
|
||||
/// The first half of the help print, name plus default, etc
|
||||
std::string help_name() const {
|
||||
std::stringstream out;
|
||||
out << get_name();
|
||||
out << get_name(true);
|
||||
if(get_expected() != 0) {
|
||||
if(typeval != "")
|
||||
out << " " << typeval;
|
||||
|
Loading…
x
Reference in New Issue
Block a user