INNER CODE UNIT · Go
main
yaklang/yaklang · common/ai/aid/aireact/cmd/aireactdeps/promptui/_examples/custom_prompt/main.go:15
func main() {
validate := func(input string) error {
_, err := strconv.ParseFloat(input, 64)
return err
}
templates := &promptui.PromptTemplates{
Prompt: "{{ . }} ",
Valid: "{{ . | green }} ",
Invalid: "{{ . | red }} ",
Success: "{{ . | bold }} ",
}
prompt := promptui.Prompt{
Label: "Spicy Level",
Templates: templates,
Validate: validate,
}