diff --git a/include/CLI/Option.hpp b/include/CLI/Option.hpp index 23a6282b..c5093b6a 100644 --- a/include/CLI/Option.hpp +++ b/include/CLI/Option.hpp @@ -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 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;