Documentation
¶
Overview ¶
Package formpage runs a wizard's pages so that accessible mode asks what the TUI shows. huh's accessible runner asks every group in turn, never consults a group's hide condition (huh v2.0.3; huh#780) and never evaluates the reactive *Func bindings, and huh exposes no way to read a hide condition back. So a wizard declares its pages here: each visible page runs on its own, built when its turn comes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(pages []Page, accessible bool, build func(...*huh.Group) *huh.Form, run func(*huh.Form) error) error
Run runs the pages through build and run. On a terminal they are one form, so back-navigation crosses pages. In accessible mode each visible page is its own form, its hide condition asked and its group built when its turn comes, so the answers on earlier pages decide both.
func ValidateAnswer ¶
ValidateAnswer validates the answer a text field will keep. At an accessible prompt huh validates the line as typed, so an empty line, which keeps the field's current value, was validated as "" and a required field refused its own pre-filled answer (huh v2.0.3; huh#833). On the TUI path the bound value follows every keystroke, so this changes nothing there.
Types ¶
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Page is one group of a wizard and the condition that hides it.
func Deferred ¶
Deferred is a page built by build. On a terminal every page is built before the form runs, as Of is; in accessible mode it is built when its turn comes, so the text it computes from earlier answers is current.
func (Page) HiddenWhen ¶
HiddenWhen hides the page while hide reports true, on the TUI path through huh and in accessible mode through Run.