Documentation
¶
Index ¶
- Constants
- Variables
- func Banner(title, subtitle string)
- func BannerSimple(title string)
- func ClearLine()
- func ClearLines(n int)
- func Confirm(message string, defaultYes bool) bool
- func ConfirmBox(title string, message string, defaultYes bool) bool
- func ConfirmWithOptions(message string, options []string, defaultIdx int) int
- func ConfirmationHints()
- func ContextualHint(message string)
- func DisplayPresetInfo(name, description string, details map[string]string)
- func ErrorIcon(txt string)
- func ErrorIconLn(txt string)
- func ErrorLn(txt string)
- func Gray() string
- func HelpBar(items []HintItem)
- func HelpBarBoxed(items []HintItem)
- func Hints(items []HintItem)
- func HintsCompact(items []HintItem)
- func HintsLine(hints string)
- func InfoIcon(txt string)
- func InfoIconLn(txt string)
- func InputPrompt(label string)
- func InputPromptWithDefault(label, defaultVal string)
- func NavigationHints()
- func PrintArrow(message string)
- func PrintBullet(message string)
- func PrintDivider(width int)
- func PrintError(message string)
- func PrintHeader(title string)
- func PrintInfo(message string)
- func PrintKeyValue(key, value string)
- func PrintKeyValueError(key, value string)
- func PrintKeyValueSuccess(key, value string)
- func PrintList(items []string)
- func PrintNumberedList(items []string)
- func PrintStep(current, total int, message string)
- func PrintSubHeader(title string)
- func PrintSuccess(message string)
- func PrintWarning(message string)
- func ProceedPrompt(message string)
- func Purple(txt string)
- func ResetColor() string
- func Section(title string, items []SectionItem)
- func SectionBox(title string, items []SectionItem)
- func SelectPreset(title string, presets []PresetOption) int
- func SelectionHints()
- func Selector(title string, options []SelectorOption, recommendedKey string)
- func SelectorSimple(title string, options []string, recommendedIdx int)
- func ShowInputError(message string)
- func SimpleSummary(title string, items []SectionItem)
- func StatusLine(message string, success bool)
- func Success(txt string)
- func SuccessIcon(txt string)
- func SuccessIconLn(txt string)
- func SuccessLn(txt string)
- func TaskStatus(task string, status string)
- func Tip(message string)
- func Title(txt string)
- func TitleLn(txt string)
- func ToDo(txt string)
- func ToDoLn(txt string)
- func ValidateNumericInput(input string, min, max int) (int, bool)
- func ValidationError(message string)
- func ValidationHint(message string)
- func ValidationWarning(message string)
- func Warning(txt string)
- func WarningIcon(txt string)
- func WarningIconLn(txt string)
- func WarningLn(txt string)
- func WithSpinner(message string, fn func() error) error
- func WithSpinnerResult(message string, fn func() (string, error)) error
- type ConfigSection
- type ConfigSummary
- type HintItem
- type InteractiveSelector
- type PresetOption
- type PromptWithValidation
- type SectionItem
- type SelectorOption
- type Spinner
- type SpinnerStyle
- type StepProgress
Constants ¶
const ( IconSuccess = "✓" IconError = "✗" IconWarning = "⚠" IconInfo = "ℹ" IconArrow = "→" IconBullet = "•" IconCheck = "✔" IconCross = "✘" IconStar = "★" IconDot = "●" IconCircle = "○" IconSquare = "■" IconTriangle = "▲" IconHeart = "♥" IconSpinner = "◐" )
Icons for CLI output
const MaxVisibleItems = 15
MaxVisibleItems is the maximum number of items to show at once
Variables ¶
var CommonHints = struct { Navigation []HintItem Confirmation []HintItem Selection []HintItem Editor []HintItem Cancel []HintItem }{ Navigation: []HintItem{ {Key: "↑/↓", Description: "Navigate"}, {Key: "Enter", Description: "Select"}, {Key: "Ctrl+C", Description: "Cancel"}, }, Confirmation: []HintItem{ {Key: "Y", Description: "Yes"}, {Key: "N", Description: "No"}, {Key: "Enter", Description: "Default"}, }, Selection: []HintItem{ {Key: "↑/↓", Description: "Navigate"}, {Key: "Enter", Description: "Select"}, {Key: "0-9", Description: "Quick select"}, }, Editor: []HintItem{ {Key: "Ctrl+S", Description: "Save"}, {Key: "Ctrl+C", Description: "Cancel"}, {Key: "Esc", Description: "Exit"}, }, Cancel: []HintItem{ {Key: "Ctrl+C", Description: "Cancel"}, }, }
CommonHints provides pre-defined hint sets
Functions ¶
func BannerSimple ¶
func BannerSimple(title string)
BannerSimple displays a simpler single-line banner
func Confirm ¶
Confirm displays a confirmation prompt and returns the user's choice defaultYes determines if Enter defaults to Yes (true) or No (false)
func ConfirmBox ¶
ConfirmBox displays a boxed confirmation prompt
func ConfirmWithOptions ¶
ConfirmWithOptions displays a confirmation with custom options
func ContextualHint ¶
func ContextualHint(message string)
ContextualHint displays a contextual hint message
func DisplayPresetInfo ¶
DisplayPresetInfo shows information about a selected preset
func ErrorIconLn ¶
func ErrorIconLn(txt string)
ErrorIconLn prints error message with cross icon and newline
func HelpBarBoxed ¶
func HelpBarBoxed(items []HintItem)
HelpBarBoxed displays hints in a boxed format
func HintsCompact ¶
func HintsCompact(items []HintItem)
HintsCompact displays hints in a more compact format
func HintsLine ¶
func HintsLine(hints string)
HintsLine displays a single line of hints with separator
func InfoIconLn ¶
func InfoIconLn(txt string)
InfoIconLn prints info message with info icon and newline
func InputPromptWithDefault ¶
func InputPromptWithDefault(label, defaultVal string)
InputPromptWithDefault displays a prompt with default value hint
func PrintKeyValue ¶
func PrintKeyValue(key, value string)
PrintKeyValue prints a key-value pair with formatting
func PrintKeyValueError ¶
func PrintKeyValueError(key, value string)
PrintKeyValueError prints a key-value pair with error icon
func PrintKeyValueSuccess ¶
func PrintKeyValueSuccess(key, value string)
PrintKeyValueSuccess prints a key-value pair with success icon
func PrintNumberedList ¶
func PrintNumberedList(items []string)
PrintNumberedList prints a numbered list
func PrintSuccess ¶
func PrintSuccess(message string)
PrintSuccess prints a success message with icon
func PrintWarning ¶
func PrintWarning(message string)
PrintWarning prints a warning message with icon
func ProceedPrompt ¶
func ProceedPrompt(message string)
ProceedPrompt displays a "Press Enter to continue" prompt
func Section ¶
func Section(title string, items []SectionItem)
Section displays a grouped section with a title and items
func SectionBox ¶
func SectionBox(title string, items []SectionItem)
SectionBox displays a boxed section with items
func SelectPreset ¶
func SelectPreset(title string, presets []PresetOption) int
SelectPreset displays an interactive preset selector and returns the selected index
func Selector ¶
func Selector(title string, options []SelectorOption, recommendedKey string)
Selector displays a styled selection box
func SelectorSimple ¶
SelectorSimple displays options without a box (for backward compatibility)
func ShowInputError ¶
func ShowInputError(message string)
ShowInputError shows error and returns cursor for re-input
func SimpleSummary ¶
func SimpleSummary(title string, items []SectionItem)
SimpleSummary displays a simple two-column summary
func StatusLine ¶
StatusLine prints a status line with icon based on success
func SuccessIcon ¶
func SuccessIcon(txt string)
SuccessIcon prints success message with checkmark icon
func SuccessIconLn ¶
func SuccessIconLn(txt string)
SuccessIconLn prints success message with checkmark icon and newline
func TaskStatus ¶
TaskStatus prints a task with its status
func ValidateNumericInput ¶
ValidateNumericInput validates that input is a number within range
func ValidationError ¶
func ValidationError(message string)
ValidationError displays an inline validation error
func ValidationWarning ¶
func ValidationWarning(message string)
ValidationWarning displays an inline validation warning
func WarningIcon ¶
func WarningIcon(txt string)
WarningIcon prints warning message with warning icon
func WarningIconLn ¶
func WarningIconLn(txt string)
WarningIconLn prints warning message with warning icon and newline
func WithSpinner ¶
WithSpinner executes a function while showing a spinner
Types ¶
type ConfigSection ¶
type ConfigSection struct {
Name string
Items []SectionItem
}
ConfigSection represents a section in the summary
type ConfigSummary ¶
type ConfigSummary struct {
Title string
Sections []ConfigSection
}
ConfigSummary displays a complete configuration summary with multiple sections
func (*ConfigSummary) Display ¶
func (cs *ConfigSummary) Display()
Display shows the configuration summary
type InteractiveSelector ¶
type InteractiveSelector struct {
Title string
Options []string
Selected int
Recommended int
// contains filtered or unexported fields
}
InteractiveSelector displays an interactive selector with arrow key navigation
func NewInteractiveSelector ¶
func NewInteractiveSelector(title string, options []string, recommended int) *InteractiveSelector
NewInteractiveSelector creates a new interactive selector
func (*InteractiveSelector) Run ¶
func (s *InteractiveSelector) Run() (int, string)
Run displays the selector and returns the selected index and value
type PresetOption ¶
PresetOption represents a preset option for selection
type PromptWithValidation ¶
type PromptWithValidation struct {
Label string
Default string
Validator func(string) (string, error)
ErrorMsg string
MaxAttempts int
}
PromptWithValidation shows a prompt and validates input
func (*PromptWithValidation) Run ¶
func (p *PromptWithValidation) Run() (string, error)
Run executes the prompt with validation
type SectionItem ¶
SectionItem represents a key-value pair in a section
type SelectorOption ¶
SelectorOption represents a single option in the selector
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays an animated spinner with a message
func NewSpinner ¶
NewSpinner creates a new spinner with the given message
func NewSpinnerWithStyle ¶
func NewSpinnerWithStyle(message string, style SpinnerStyle) *Spinner
NewSpinnerWithStyle creates a spinner with a specific style
func (*Spinner) StopWithError ¶
StopWithError stops and shows an error message
func (*Spinner) StopWithMessage ¶
StopWithMessage stops the spinner and shows a final message
func (*Spinner) StopWithSuccess ¶
StopWithSuccess stops and shows a success message
func (*Spinner) StopWithWarning ¶
StopWithWarning stops and shows a warning message
func (*Spinner) UpdateMessage ¶
UpdateMessage updates the spinner message while running
type SpinnerStyle ¶
type SpinnerStyle int
SpinnerStyle defines different spinner animations
const ( SpinnerDots SpinnerStyle = iota SpinnerLine SpinnerCircle SpinnerBounce )
type StepProgress ¶
type StepProgress struct {
// contains filtered or unexported fields
}
StepProgress manages and displays setup progress
func NewStepProgress ¶
func NewStepProgress(steps []string) *StepProgress
NewStepProgress creates a new progress tracker
func (*StepProgress) Complete ¶
func (sp *StepProgress) Complete()
Complete displays a completion message
func (*StepProgress) Display ¶
func (sp *StepProgress) Display()
Display shows the current progress bar and step name
func (*StepProgress) DisplayCompact ¶
func (sp *StepProgress) DisplayCompact()
DisplayCompact shows a compact single-line progress
func (*StepProgress) SetStep ¶
func (sp *StepProgress) SetStep(step int)
SetStep sets the current step (1-indexed for user display)