cli

package
v0.12.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompter

type Prompter struct {
	// contains filtered or unexported fields
}

Prompter wraps I/O for interactive prompts.

func NewPrompter

func NewPrompter(r io.Reader, w io.Writer) *Prompter

NewPrompter returns a Prompter backed by the provided reader and writer.

func (*Prompter) Ask

func (p *Prompter) Ask(label, defaultValue string) (string, error)

Ask prompts for a single-line text input.

func (*Prompter) Confirm

func (p *Prompter) Confirm(label string, defaultValue bool) (bool, error)

Confirm prompts for a yes/no answer.

func (*Prompter) MultiInput

func (p *Prompter) MultiInput(label string) ([]string, error)

MultiInput collects multiple values until the user enters an empty line.

func (*Prompter) MultiSelect

func (p *Prompter) MultiSelect(label string, options []string, defaultAll bool) ([]string, error)

MultiSelect presents a numbered list and returns the selected items.

func (*Prompter) MultiSelectWithDefaults

func (p *Prompter) MultiSelectWithDefaults(label string, options []string, defaultIndices []int) ([]string, error)

MultiSelectWithDefaults presents a numbered list and returns the selected items.

func (*Prompter) Select

func (p *Prompter) Select(label string, options []string, defaultIndex int) (string, error)

Select presents a numbered list and returns the selected item.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL