Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a validator for Yes/No prompt #106

Closed
ghost opened this issue Jun 18, 2019 · 3 comments · Fixed by #114
Closed

Set a validator for Yes/No prompt #106

ghost opened this issue Jun 18, 2019 · 3 comments · Fixed by #114

Comments

@ghost
Copy link

ghost commented Jun 18, 2019

If I type a value that cannot be convert to Boolean will raise a exception:

from /usr/lib/ruby/gems/2.6.0/gems/tty-prompt-0.18.1/lib/tty/prompt/converters.rb:23:in `rescue in on_error'
TTY::Prompt::ConversionError ('2' could not be converted from `string` into `boolean` )

A validator should be set to prevent users from entering other values.

@piotrmurach
Copy link
Owner

Thanks for reporting. I agree it's better to prevent erroneous input or display error message about invalid input so the user can correct. Can you please submit PR fixing this?

@ghost
Copy link
Author

ghost commented Jul 23, 2019

@piotrmurach I am not very familiar your code, I don't necessarily have time recently.I suggest you fix this little issue by yourself.

@slowbro
Copy link
Contributor

slowbro commented Oct 3, 2019

i fixed this 'little issue' - pr #114

piotrmurach added a commit that referenced this issue Oct 3, 2019
fix #106 - yes? and no? shouldn't raise an exception on invalid/blank input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants