Documentation
¶
Overview ¶
Package forms provides multi-stage interactive form wizards built on top of the huh library, supporting forward/back navigation, dynamic stage construction, and navigable form groups for CLI project configuration workflows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNavigable ¶
NewNavigable creates a huh.Form with Escape bound to Quit and rendering in the alternate screen buffer. Each form gets a clean display and leaves no residual output when it completes or is aborted. Pressing Escape causes Run() to return huh.ErrUserAborted, which a Wizard interprets as "go back one step".
func RunStepsWithBack ¶
RunStepsWithBack executes a sequence of form step functions with back-navigation support. Prefer Wizard for new code; this function is retained for backward compatibility.
Types ¶
type Wizard ¶
type Wizard struct {
// contains filtered or unexported fields
}
Wizard manages a multi-step interactive form flow with Escape-to-go-back navigation. Each step is either a static set of huh.Groups displayed as a single navigable form, or a custom function for dynamic logic.
Build with NewWizard, optionally extend with Group/Step, then call Run.
func NewWizard ¶
NewWizard creates a Wizard whose initial steps are the given groups — each group becomes one navigable form step. For a purely static multi-step flow this is all you need:
err := forms.NewWizard(groupA, groupB, groupC).Run()
For mixed flows, chain Group and Step after the constructor.
func (*Wizard) Group ¶
Group adds a step that displays one or more huh groups as a single navigable form. Use this for static form content that doesn't depend on earlier steps.