Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Prompt again #165

Merged
merged 4 commits into from
Dec 11, 2018
Merged

Prompt again #165

merged 4 commits into from
Dec 11, 2018

Conversation

orymate
Copy link
Contributor

@orymate orymate commented Nov 29, 2018

Recall the previous invalid input in the repeated Editor prompt so the user doesn't have to start over typing a long answer (for example a json structure).

Add optional PromptAgain method to Prompts to back this.

Mate Ory added 2 commits November 29, 2018 13:27
Support different behavior after a validation error in repeated prompts.

Signed-off-by: Mate Ory <mate.ory@banzaicloud.com>
Recall the previous invalid input in the repeated prompt so the user
doesn't have to start over typing the answer.

Signed-off-by: Mate Ory <mate.ory@banzaicloud.com>
@orymate
Copy link
Contributor Author

orymate commented Dec 2, 2018

Hello @AlecAivazis, could you please check this PR?

@AlecAivazis
Copy link
Owner

Hey @orymate - sorry for lagging a bit on this.

I think this makes sense. Forcing the user to re-enter something they were just working on seems like a bad user experience.

Overall, the code looks fine. Would you mind adding a test for this?

@orymate
Copy link
Contributor Author

orymate commented Dec 4, 2018

Hello,
does the test in 75e46df make sense? I did not catch the intention behind the go routine I removed, but it triggered errors after the extension, while it did work for me sequentially.

@AlecAivazis
Copy link
Owner

Thanks for adding that - it looks like you changed an existing test to cover your needs which makes it hard to track test failures (since the test is really testing 2 different things). Could you move the test into another test case?

@orymate
Copy link
Contributor Author

orymate commented Dec 5, 2018

Added separate test.

@orymate
Copy link
Contributor Author

orymate commented Dec 10, 2018

@AlecAivazis, can I do anything more to have this merged?

@AlecAivazis
Copy link
Owner

AlecAivazis commented Dec 10, 2018

Hey @orymate!

I tried to add a test that would showcase the behavior to tests/editor.go but I couldn't get it to work. Could you add one there as well so I can run this on my laptop? Having the automatic ones are helpful for regressions but i still would like something to run by hand

@orymate
Copy link
Contributor Author

orymate commented Dec 11, 2018

@AlecAivazis, I added the manual test code

@AlecAivazis
Copy link
Owner

Awesome! Thanks for adding that - worked like a charm.

@AlecAivazis AlecAivazis merged commit e205523 into AlecAivazis:master Dec 11, 2018
siredmar pushed a commit to siredmar/survey that referenced this pull request Feb 20, 2020
* survey: pass previous invalid value to Prompt

Support different behavior after a validation error in repeated prompts.

Signed-off-by: Mate Ory <mate.ory@banzaicloud.com>

* editor: recall previous invalid input

Recall the previous invalid input in the repeated prompt so the user
doesn't have to start over typing the answer.

Signed-off-by: Mate Ory <mate.ory@banzaicloud.com>

* survey_test: check recalling invalid Editor input

* tests: add prompt-again editor manual test
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants