Commit cf667f28a99ab01abbed0209ba027f3cd67b7a61

Authored by Henry Fredrick Schreiner
1 parent 9b31ef38

removing added pname from helpstring for optional

Showing 1 changed file with 4 additions and 18 deletions
include/CLI/Option.hpp
... ... @@ -159,10 +159,10 @@ public:
159 159 return false;
160 160 }
161 161  
162   - /// Gets a , sep list of names. Does not include the positional name.
163   - std::string get_name() const {
  162 + /// Gets a , sep list of names. Does not include the positional name if opt_only=true.
  163 + std::string get_name(bool opt_only=false) const {
164 164 std::vector<std::string> name_list;
165   - if(pname.length() > 0)
  165 + if(!opt_only && pname.length() > 0)
166 166 name_list.push_back(pname);
167 167 for(const std::string& sname : snames)
168 168 name_list.push_back("-"+sname);
... ... @@ -212,24 +212,10 @@ public:
212 212 return out;
213 213 }
214 214  
215   - /// Diagnostic representation
216   - std::string string() const {
217   - std::string val = "Option: " + get_name() + "\n"
218   - + " " + description + "\n"
219   - + " [";
220   - for(const auto& item : results) {
221   - if(&item!=&results[0])
222   - val+="],[";
223   - val += detail::join(item);
224   - }
225   - val += "]";
226   - return val;
227   - }
228   -
229 215 /// The first half of the help print, name plus default, etc
230 216 std::string help_name() const {
231 217 std::stringstream out;
232   - out << get_name();
  218 + out << get_name(true);
233 219 if(get_expected() != 0) {
234 220 if(typeval != "")
235 221 out << " " << typeval;
... ...