Commit 6a3b111b7115f295b4e5b9644f90cd8d876cf52e

Authored by Henry Fredrick Schreiner
1 parent cb2646a5

Slighly better error message

CHANGELOG.md
  1 +## Version 0.8 (in progress)
  2 +
  3 +* Moved to CLTools on GitHub
  4 +
1 ## Version 0.7 5 ## Version 0.7
  6 +
2 * Allow comments in ini files (lines starting with `;`) 7 * Allow comments in ini files (lines starting with `;`)
3 * Ini files support flags, vectors, subcommands 8 * Ini files support flags, vectors, subcommands
4 * Added CodeCov code coverage reports 9 * Added CodeCov code coverage reports
include/CLI/Option.hpp
@@ -155,12 +155,12 @@ public: @@ -155,12 +155,12 @@ public:
155 155
156 /// Set the number of expected arguments (Flags bypass this) 156 /// Set the number of expected arguments (Flags bypass this)
157 Option* expected(int value) { 157 Option* expected(int value) {
158 - if(!changeable_)  
159 - throw IncorrectConstruction("You can only change the expected arguments for vectors");  
160 - else if(value == 0) 158 + if(value == 0)
161 throw IncorrectConstruction("Cannot set 0 expected, use a flag instead"); 159 throw IncorrectConstruction("Cannot set 0 expected, use a flag instead");
162 else if(expected_ == 0) 160 else if(expected_ == 0)
163 throw IncorrectConstruction("Cannot make a flag take arguments!"); 161 throw IncorrectConstruction("Cannot make a flag take arguments!");
  162 + else if(!changeable_)
  163 + throw IncorrectConstruction("You can only change the expected arguments for vectors");
164 expected_ = value; 164 expected_ = value;
165 return this; 165 return this;
166 } 166 }