Questionnaire
This page describes the questionnaire package, which enables to query the user about a series of questions and is available in github.com/chordflower/vimle/pkg/questions
.
It will allow for the following types of questions:
- text input → Allow an user to input text, either single or multi line;
- integer → Allow an user to input an integer number, allowing for configuration of minimum and maximum;
- decimal → Allow an user to input a decimal number, allowing for configuration of minimum, maximum and scale;
- boolean → Allow an user to answer simple yes or no questions;
- character or rune → Allow the user to input a character or rune;
- hidden text → Allow an user to input a single line of text, which will not be visible on the console;
- choice → Allow an user to select an option from a list;
- multi-choice → Allow an user to select multiple options from a list.
Types
In terms of types these are the available question types:
Each type has a method named New<TypeName>
that creates an instance of it:
NewBooleanQuestion(question string) *BooleanQuestion
→ Create a new BooleanQuestion;NewCharacterQuestion(question string) *CharacterQuestion
→ Create a new CharacterQuestion;NewChoiceQuestion(question string, choices []string) *ChoiceQuestion
&rarr: Create a new ChoiceQuestion;NewDecimalQuestion(question string) *DecimalQuestion
→ Create a new DecimalQuestion;NewHiddenQuestion(question string) *HiddenQuestion
→ Create a new HiddenQuestion;NewIntegerQuestion(question string) *IntegerQuestion
→ Create a new IntegerQuestion;NewMultiChoiceQuestion(question string, choices []string) *MultiChoiceQuestion
→ Create a new MultiChoiceQuestion;NewTextQuestion(question string) *TextQuestion
→ Create a new TextQuestion.