Documentation
¶
Index ¶
- Variables
- func BuildSurvey(questions []*Question) (*huh.Form, map[string]interface{}, error)
- func ConvertToType(value string, typ string) interface{}
- func GetRandomAnswers(questions []*Question) map[string]interface{}
- func ReadYAMLFile(filePath string) (string, error)
- func RegisterFunction(name string, fn func(params map[string]interface{}) string)
- func RunSurvey(profilePath, surveyKey string) (surveyValues map[string]interface{})
- func RunSurveyWithRandomSelects(profilePath, surveyKey string, runSurvey bool) map[string]interface{}
- type ListModel
- type Question
- type Save
- type Text
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFunctions = make(map[string]func(params map[string]interface{}) string)
DefaultFunctions holds the registered functions
Functions ¶
func BuildSurvey ¶
BUILD THE SURVEY FUNCTION WITH THE NEW RANDOM SETUP
func ConvertToType ¶ added in v0.5.0
func GetRandomAnswers ¶ added in v0.5.0
func ReadYAMLFile ¶ added in v0.2.0
func RegisterFunction ¶ added in v0.4.0
RegisterFunction adds a function to the registry
func RunSurveyWithRandomSelects ¶ added in v0.4.0
func RunSurveyWithRandomSelects(profilePath, surveyKey string, runSurvey bool) map[string]interface{}
RunSurveyWithRandomSelects runs the survey but generates random answers for select questions if runSurvey is false
Types ¶
type ListModel ¶ added in v0.4.1
type ListModel struct {
FinalOutput string
// contains filtered or unexported fields
}
func InitListModel ¶ added in v0.4.1
type Question ¶
type Question struct {
Prompt string `yaml:"prompt"`
Name string `yaml:"name"`
Default string `yaml:"default,omitempty"`
DefaultFunction string `yaml:"default_function,omitempty"`
DefaultParams map[string]interface{} `yaml:"default_params,omitempty"`
Options []string `yaml:"options"`
Kind string `yaml:"kind,omitempty"` // "function" instead of "text"
MinLength int `yaml:"minLength,omitempty"`
MaxLength int `yaml:"maxLength,omitempty"`
Type string `yaml:"type,omitempty"` // Updated field to match the YAML
}
QUESTION STRUCT TO HOLD THE QUESTION DATA FROM YAML
func LoadQuestionFile ¶
type Save ¶ added in v0.2.0
type Save struct {
// contains filtered or unexported fields
}
SAVE MODEL HOLDS THE STATE FOR THE SAVE FUNCTIONALITY.
func InitialSaveModel ¶ added in v0.2.0
InitialSaveModel initializes the Save model with a file picker and text input for the filename.
type Text ¶ added in v0.2.0
type Text struct {
Textarea textarea.Model
ErrMsg string
Quitting bool
WindowSize tea.WindowSizeMsg // Track window size for responsive layout
}
MODEL HOLDS THE STATE FOR THE TERMINAL UI.
func InitialModel ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.