1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-03 14:03:52 +00:00

Slighly better error message

This commit is contained in:
Henry Fredrick Schreiner 2017-03-23 16:02:58 -04:00
parent cb2646a56c
commit 6a3b111b71
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,9 @@
## Version 0.8 (in progress)
* Moved to CLTools on GitHub
## Version 0.7 ## Version 0.7
* Allow comments in ini files (lines starting with `;`) * Allow comments in ini files (lines starting with `;`)
* Ini files support flags, vectors, subcommands * Ini files support flags, vectors, subcommands
* Added CodeCov code coverage reports * Added CodeCov code coverage reports

View File

@ -155,12 +155,12 @@ public:
/// Set the number of expected arguments (Flags bypass this) /// Set the number of expected arguments (Flags bypass this)
Option* expected(int value) { Option* expected(int value) {
if(!changeable_) if(value == 0)
throw IncorrectConstruction("You can only change the expected arguments for vectors");
else if(value == 0)
throw IncorrectConstruction("Cannot set 0 expected, use a flag instead"); throw IncorrectConstruction("Cannot set 0 expected, use a flag instead");
else if(expected_ == 0) else if(expected_ == 0)
throw IncorrectConstruction("Cannot make a flag take arguments!"); throw IncorrectConstruction("Cannot make a flag take arguments!");
else if(!changeable_)
throw IncorrectConstruction("You can only change the expected arguments for vectors");
expected_ = value; expected_ = value;
return this; return this;
} }