Documentation
¶
Index ¶
- Variables
- type HuhPrompter
- func (p *HuhPrompter) Confirm(title string, defaultValue bool) (bool, error)
- func (p *HuhPrompter) Input(title string, defaultValue string) (string, error)
- func (p *HuhPrompter) MultiSelect(title string, options []string) ([]string, error)
- func (p *HuhPrompter) Select(title string, options []string) (string, error)
- type NoopPrompter
- func (p *NoopPrompter) Confirm(title string, defaultValue bool) (bool, error)
- func (p *NoopPrompter) Input(title string, defaultValue string) (string, error)
- func (p *NoopPrompter) MultiSelect(title string, options []string) ([]string, error)
- func (p *NoopPrompter) Select(title string, options []string) (string, error)
- type Prompter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNonInteractive = errors.New("cannot prompt in non-interactive mode")
ErrNonInteractive is returned when prompting in non-interactive mode.
Functions ¶
This section is empty.
Types ¶
type HuhPrompter ¶
type HuhPrompter struct{}
HuhPrompter implements Prompter using the charmbracelet/huh library.
func NewHuhPrompter ¶
func NewHuhPrompter() *HuhPrompter
NewHuhPrompter creates a new huh-based prompter.
func (*HuhPrompter) Confirm ¶
func (p *HuhPrompter) Confirm(title string, defaultValue bool) (bool, error)
func (*HuhPrompter) Input ¶
func (p *HuhPrompter) Input(title string, defaultValue string) (string, error)
func (*HuhPrompter) MultiSelect ¶
func (p *HuhPrompter) MultiSelect(title string, options []string) ([]string, error)
type NoopPrompter ¶
type NoopPrompter struct{}
NoopPrompter returns errors for all prompts (non-interactive mode).
func (*NoopPrompter) Confirm ¶
func (p *NoopPrompter) Confirm(title string, defaultValue bool) (bool, error)
func (*NoopPrompter) Input ¶
func (p *NoopPrompter) Input(title string, defaultValue string) (string, error)
func (*NoopPrompter) MultiSelect ¶
func (p *NoopPrompter) MultiSelect(title string, options []string) ([]string, error)
type Prompter ¶
type Prompter interface {
// Select presents options and returns the selected value.
Select(title string, options []string) (string, error)
// Input prompts for text input.
Input(title string, defaultValue string) (string, error)
// Confirm prompts for yes/no.
Confirm(title string, defaultValue bool) (bool, error)
// MultiSelect allows selecting multiple options.
MultiSelect(title string, options []string) ([]string, error)
}
Prompter defines the interface for interactive user prompts.
Click to show internal directories.
Click to hide internal directories.