-
Notifications
You must be signed in to change notification settings - Fork 355
Conversation
Hey Cory, thanks for yet another PR. I'll leave some comments inline. I did some thinking about our problem today and what do you think about extending the analogy with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty good overall! I think we should be a bit more defensive. Since the Answer
field is not verified anywhere, it's easy to get a null-pointer reference if you fmt.Println(prompt.Answer)
} | ||
|
||
// return the value | ||
*confirm.Answer = answer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user doesn't provide an answer when instantiating this prompt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh! I meant to add that logic, forgot. Like in MultiChoice I just check to see if the value is nil
and then create a default answer.
Awesome! Thanks for making those changes. I'm going to merge this in now. |
add Confirm prompt
Adding basic Y/n confirmation prompt. The implementation is similar to MultiChoice in that I have added an Answer that users can populate to get a
bool
result, otherwise it returns aYes
orNo
string depending on the answer. This will also loop if we get an answer that we cannot parse.