Open johanpel opened 3 months ago
CC @phlptp
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: