bchao1 / bullet

🚅 Interactive prompts made simple. Build a prompt like stacking blocks.
https://pypi.org/project/bullet/
MIT License
3.55k stars 113 forks source link

Dynamically pass `valid` methods #38

Open agritheory opened 5 years ago

agritheory commented 5 years ago

The pattern='some_regex' doesn't handle None/ "" inputs.

It would be reasonable to pass a validation method in the constructor and have it default to the builtin. This would allow for inline validation, which is almost always better UX.

Input("Enter database name: ",
    word_color=colors.foreground["blue"],
    strip=True,
    valid=my_input_validation),