You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like a bug was introduced in v2.4.0 where combining Option::envname with a validator through Option::check no longer properly fails to validate when the provided value is invalid.
-i: Value 1 not in range [2 - 10]
Run with --help for more information.
However, when this is executed with CLI11_ENVNAME_WITH_VALIDATOR_BUG=1 ./test, this fails to error out on the invalid value, uses the default value, and returns:
0
In v2.3.1 this was still working as expected and correctly returns:
-i: Value 1 not in range [2 - 10]
Run with --help for more information.
The text was updated successfully, but these errors were encountered:
Having validators on environmental variables fail had the potential to cause issues with various other mechanics, including preventing help, version, or other short circuit mechanisms from operating with no user controllable way to bypass. To prevent that kind of issue, validator failures on environmental variables are treated as if the environmental variable was not present. This is not a perfect option, but I think had to be treated this way to prevent some more egregious usability failures. Some future designs for handling exceptions differently may resolve the conflict and allow multiple error conditions, but that will be a bigger effort.
First of all, thank you for this project!
It looks like a bug was introduced in
v2.4.0
where combiningOption::envname
with a validator throughOption::check
no longer properly fails to validate when the provided value is invalid.For example, consider the following program:
Running this with
./test -i 1
correctly returns:However, when this is executed with
CLI11_ENVNAME_WITH_VALIDATOR_BUG=1 ./test
, this fails to error out on the invalid value, uses the default value, and returns:In
v2.3.1
this was still working as expected and correctly returns:The text was updated successfully, but these errors were encountered: