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

Adds 'required' option to 'prompt_for_input' #237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nkakouros
Copy link

cc: @mbland

This PR adds an extra argument to @go.prompt_for_input. If the function is called with this argument, eg @go.prompt_for_input 'variable' 'prompt' '' '' 'required' and the user supplies no value, ie presses only enter, the prompt will reappear until the user actually supplies something. If instead of required another value is supplied, the behavior is the already existing one.

The rational behind this PR is that as it stands now, using @go.prompt_for_input in a loop to force the user to actually submit sth, is exactly identical to using read directly. It saves nothing. With this PR, it only takes one line and you are sure that the user will provide some input. Moreover, @go.prompt_for_yes_or_no already loops until the user supplies something. This PR makes the two functions more "feature compatible".

@coveralls
Copy link

coveralls commented Jan 21, 2018

Coverage Status

Coverage increased (+0.007%) to 95.004% when pulling 78d77b3 on tterranigma:prompt into 292e080 on mbland:master.

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 this pull request may close these issues.

2 participants