Documentation
¶
Index ¶
- Variables
- func IsValidPromptType(promptType string) bool
- func IsValidTransformerType(transformerType string) bool
- func IsValidValidatorType(validatorType string) bool
- type Answer
- type AnswerMap
- type GlobalAnswers
- type Prompt
- type Question
- type QuestionOptions
- type QuestionValidation
- type WhenEnvironment
Constants ¶
This section is empty.
Variables ¶
var Answers = make(GlobalAnswers)
Answers are the global stored answers
Functions ¶
func IsValidPromptType ¶
IsValidPromptType checks that the given promptType is valid.
func IsValidTransformerType ¶ added in v1.7.0
IsValidTransformerType checks that the given promptType is valid.
func IsValidValidatorType ¶ added in v1.7.0
IsValidValidatorType checks that the given promptType is valid.
Types ¶
type Answer ¶
type Answer struct {
// contains filtered or unexported fields
}
Answer holds the Prompt Answer configuration.
func (*Answer) WriteAnswer ¶
WriteAnswer writes the answers to the global AnswerMap var.
type GlobalAnswers ¶ added in v1.7.0
GlobalAnswers is all prompt answers.
type Prompt ¶
type Prompt struct {
Name string `yaml:"name"`
Answers AnswerMap
Questions []Question `yaml:"questions"`
}
Prompt holds Prompt configuration.
type Question ¶
type Question struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Options QuestionOptions `yaml:"prompt"`
Validate QuestionValidation `yaml:"validate"`
Transform string `yaml:"transform"`
When string `yaml:"when"`
}
Question holds the Survey question configs.
func (Question) AsSurveyQuestion ¶
AsSurveyQuestion coerces the question into a survey.Question type.
func (Question) CheckValid ¶ added in v1.7.0
CheckValid checks if the question's answer is valid according to the specifications for the specified Question.
func (Question) Transformer ¶
func (question Question) Transformer() survey.Transformer
Transformer returns the survey.Transformer for the specific Question.
type QuestionOptions ¶
type QuestionOptions struct {
Message string `yaml:"message"`
Default string `yaml:"default"`
Help string `yaml:"help"`
Options []string `yaml:"options"`
PageSize int `yaml:"pageSize"`
VimMode bool `yaml:"vimMode"`
Editor string `yaml:"editor"`
HideDefault bool `yaml:"hideDefault"`
AppendDefault bool `yaml:"appendDefault"`
FileName string `yaml:"fileName"`
}
QuestionOptions provides option storage for Survey Question instances.
type QuestionValidation ¶
type QuestionValidation struct {
Required bool `yaml:"required"`
MinLength int `yaml:"minLength"`
MaxLength int `yaml:"maxLength"`
}
QuestionValidation provides validation options for Survey Question instances.
type WhenEnvironment ¶ added in v1.7.0
WhenEnvironment is the object passed into the When environment.