Documentation
¶
Overview ¶
Package prompt provides interactive terminal prompts for CLI operations.
Index ¶
- type ProgressBar
- type Prompter
- func (p *Prompter) Confirm(message string, defaultValue bool) (bool, error)
- func (p *Prompter) Error(message string)
- func (p *Prompter) Info(message string)
- func (p *Prompter) Input(message string, defaultValue string) (string, error)
- func (p *Prompter) IsInteractive() bool
- func (p *Prompter) MultiSelect(message string, options []string, defaults []int) ([]int, []string, error)
- func (p *Prompter) Password(message string) (string, error)
- func (p *Prompter) Print(format string, args ...interface{})
- func (p *Prompter) Select(message string, options []string, defaultIndex int) (int, string, error)
- func (p *Prompter) Success(message string)
- func (p *Prompter) Warning(message string)
- type Spinner
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar displays a simple progress bar.
func NewProgressBar ¶
func NewProgressBar(out io.Writer, total int) *ProgressBar
NewProgressBar creates a new progress bar.
func (*ProgressBar) Complete ¶
func (pb *ProgressBar) Complete()
Complete marks the progress bar as complete.
func (*ProgressBar) Increment ¶
func (pb *ProgressBar) Increment()
Increment increments the progress bar by 1.
func (*ProgressBar) Update ¶
func (pb *ProgressBar) Update(current int)
Update updates the progress bar.
type Prompter ¶
type Prompter struct {
// In is the input reader (defaults to os.Stdin).
In io.Reader
// Out is the output writer (defaults to os.Stderr).
Out io.Writer
// Err is the error writer (defaults to os.Stderr).
Err io.Writer
// NoColor disables color output.
NoColor bool
// NonInteractive skips prompts and uses defaults.
NonInteractive bool
}
Prompter handles interactive terminal prompts.
func (*Prompter) IsInteractive ¶
IsInteractive returns true if the terminal is interactive.
func (*Prompter) MultiSelect ¶
func (p *Prompter) MultiSelect(message string, options []string, defaults []int) ([]int, []string, error)
MultiSelect prompts the user to select multiple options.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays a simple progress indicator.
Click to show internal directories.
Click to hide internal directories.