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

README.md lies about #no? behavior #11

Closed
vizvamitra opened this issue Mar 10, 2016 · 6 comments
Closed

README.md lies about #no? behavior #11

vizvamitra opened this issue Mar 10, 2016 · 6 comments

Comments

@vizvamitra
Copy link

README.md states:

prompt.no?('Do you hate Ruby?')
# =>
# Do you hate Ruby? (y/N)

What really happends:

hates_ruby = prompt.no?('Do you hate Ruby?')
# =>
# Do you hate Ruby? (Y/n) <--- shows another default 

Also I've failed to find a way to make .ask(..., convert: :bool) to show (y/N), so perhaps it is an issue with it (or with README.md)

@piotrmurach
Copy link
Owner

Hi Dmitrii, the code is broken, there's already pull request submitted that fixes it. I will merge shortly.

@piotrmurach
Copy link
Owner

This is implemented in master, if you've got a minute to spare to try it out that would be sweet. The readme explains how to customize the yes? & no? with new options.

@vizvamitra
Copy link
Author

@peter-murach I like the new version, though it still has some issues. For example:

a.yes?('Can I set default to "no" here?', default: false) # No, default is still true
a.no?('Can I set default to "yes" here?', default: true) # Yes, I can (but ot still shows y/N)

I think is should allow me to decide what answer should be the default because it is often a question of formulation: whether to use #yes? or #no?

Also it seems that I'll need do define all 4 options in order to have a customized question. I understand that it is a trade-off for a current flexibility, yet it feels a little annoying.

Nevertheless, it is now much better than before. Thanks for your work, I like this gem very much)

@piotrmurach
Copy link
Owner

Totally agree, the default is actually meant to change the answer. I suppose 4 options feels clunky, I'm trying to reuse functionality built in such as conversion function. I'm happy to consider different approach, do you have any examples I could take a look at? This is not released yet so we can tweak functionality until it's awesome.

@piotrmurach
Copy link
Owner

@vizvamitra I've fixed the bug and changed the behaviour to allow you to specify only suffix to get custom yes?/no? prompt working. Everything is documented in readme. I hope you find the interface less clunky this time?

@piotrmurach
Copy link
Owner

@vizvamitra I've released v0.5.0 that has all the changes, please read for more info.

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

No branches or pull requests

2 participants