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 5 ## Version 0.7
  6 +
2 7 * Allow comments in ini files (lines starting with `;`)
3 8 * Ini files support flags, vectors, subcommands
4 9 * Added CodeCov code coverage reports
... ...
include/CLI/Option.hpp
... ... @@ -155,12 +155,12 @@ public:
155 155  
156 156 /// Set the number of expected arguments (Flags bypass this)
157 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 159 throw IncorrectConstruction("Cannot set 0 expected, use a flag instead");
162 160 else if(expected_ == 0)
163 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 164 expected_ = value;
165 165 return this;
166 166 }
... ...