Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrQuestionNotAnswered = errors.New("question.Answer() called without the question having been successfully asked")
Functions ¶
func AskQuestions ¶
AskQuestions takes a list of questions and asks each one in sequence, returning the list of answers
Types ¶
type ClosedQuestion ¶
ClosedQuestion is a prompt where the user can choose from a fixed set of answers
type OpenEndedQuestion ¶
type OpenEndedQuestion struct { Question string Default string AllowEdit bool Validate func(string) error }
OpenEndedQuestion is a prompt where the user can provide any answer
type QuestionBranch ¶
type QuestionBranch struct { ConditionQuestion Question ConditionAnswer Answer BranchA []Question BranchB []Question }
QuestionBranch is a sort of "meta-question" whose Ask method will delegate to ConditionQuestion and execute BranchA if ConditionAnswer is met, otherwise execute BranchB
func (*QuestionBranch) Answer ¶
func (q *QuestionBranch) Answer() Answer
func (*QuestionBranch) Ask ¶
func (q *QuestionBranch) Ask() error
type Questioner ¶
type Questioner interface { NewOpenEndedQuestion(question *OpenEndedQuestion) Question NewClosedQuestion(question *ClosedQuestion) Question }
Click to show internal directories.
Click to hide internal directories.