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
$ python test.py -v 10.0
Usage: test.py [OPTIONS]
Try 'test.py --help' for help.
Error: Invalid value for '-v': '10.0' is not a valid integer.
The Function validator should accept a function returning a str | None instead of a bool to indicate the failure description.
I was trying to call ParamType.convert in a Function validator to validate input. Ideally, I should be able to capture the error message in the BadParameter exception to generate the failure description. But right now the failure description can only be a fixed string.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I was playing with Trogon and tried to add text input validators in Textualize/trogon#59. Some thoughts:
The
Integer
validator should reject integer values in float point format.Today, the
Integer
validator accepts input like1.0
, which is rejected byclick.INT
:The
Function
validator should accept a function returning astr | None
instead of abool
to indicate the failure description.I was trying to call
ParamType.convert
in aFunction
validator to validate input. Ideally, I should be able to capture the error message in theBadParameter
exception to generate the failure description. But right now the failure description can only be a fixed string.Beta Was this translation helpful? Give feedback.
All reactions