Documentation
¶
Overview ¶
Package output provides CLI output utilities with color support.
Package output provides CLI output utilities with color support.
Index ¶
- Variables
- func VisibleWidth(s string) int
- type Printer
- func (p *Printer) Error(format string, args ...interface{})
- func (p *Printer) Info(format string, args ...interface{})
- func (p *Printer) Print(format string, args ...interface{})
- func (p *Printer) Printf(format string, args ...interface{})
- func (p *Printer) Println(args ...interface{})
- func (p *Printer) SetErrorOutput(w io.Writer)
- func (p *Printer) SetOutput(w io.Writer)
- func (p *Printer) Styles() *Styles
- func (p *Printer) Success(format string, args ...interface{})
- func (p *Printer) Warning(format string, args ...interface{})
- type Spinner
- type SpinnerOption
- type Styles
- func (s *Styles) ErrorIcon() string
- func (s *Styles) FormatAgentName(name string) string
- func (s *Styles) FormatBadge(text, variant string) string
- func (s *Styles) FormatHeader(text string) string
- func (s *Styles) FormatMethod(method string) string
- func (s *Styles) FormatStatus(status string) string
- func (s *Styles) FormatVersion(version string, hasUpdate bool) string
- func (s *Styles) InfoIcon() string
- func (s *Styles) InstalledIcon() string
- func (s *Styles) NotInstalledIcon() string
- func (s *Styles) SuccessIcon() string
- func (s *Styles) UpdateIcon() string
- func (s *Styles) WarningIcon() string
- type Table
Constants ¶
This section is empty.
Variables ¶
var SpinnerFrames = struct { Dots []string Line []string Arrow []string Pulse []string Binary []string Circle []string }{ Dots: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, Line: []string{"-", "\\", "|", "/"}, Arrow: []string{"←", "↖", "↑", "↗", "→", "↘", "↓", "↙"}, Pulse: []string{"◐", "◓", "◑", "◒"}, Binary: []string{"010010", "001001", "100100", "010010", "001001"}, Circle: []string{"◜", "◠", "◝", "◞", "◡", "◟"}, }
SpinnerFrames contains predefined spinner frame sets.
Functions ¶
func VisibleWidth ¶
VisibleWidth returns the visible width of a string (excluding ANSI codes)
Types ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer handles colorized output for CLI commands.
func NewPrinter ¶
NewPrinter creates a new Printer instance.
func (*Printer) Println ¶
func (p *Printer) Println(args ...interface{})
Println prints a message with a newline.
func (*Printer) SetErrorOutput ¶
SetErrorOutput sets the error output writer.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays a loading animation in the terminal.
func NewSpinner ¶
func NewSpinner(opts ...SpinnerOption) *Spinner
NewSpinner creates a new spinner instance.
func (*Spinner) UpdateMessage ¶
UpdateMessage updates the spinner message while it's running.
type SpinnerOption ¶
type SpinnerOption func(*Spinner)
SpinnerOption is a functional option for configuring a Spinner.
func WithFrames ¶
func WithFrames(frames []string) SpinnerOption
WithFrames sets custom spinner frames.
func WithInterval ¶
func WithInterval(interval time.Duration) SpinnerOption
WithInterval sets the spinner animation interval.
func WithOutput ¶
func WithOutput(w io.Writer) SpinnerOption
WithOutput sets the spinner output writer.
type Styles ¶
type Styles struct {
// Colors
Purple lipgloss.Color
Green lipgloss.Color
Orange lipgloss.Color
Red lipgloss.Color
Cyan lipgloss.Color
Yellow lipgloss.Color
Gray lipgloss.Color
White lipgloss.Color
// Text styles
Success lipgloss.Style
Error lipgloss.Style
Warning lipgloss.Style
Info lipgloss.Style
Muted lipgloss.Style
Bold lipgloss.Style
Header lipgloss.Style
// Status styles
StatusInstalled lipgloss.Style
StatusUpdate lipgloss.Style
StatusNotFound lipgloss.Style
StatusError lipgloss.Style
// Badge styles
Badge lipgloss.Style
BadgeSuccess lipgloss.Style
BadgeWarning lipgloss.Style
BadgeError lipgloss.Style
BadgeInfo lipgloss.Style
// contains filtered or unexported fields
}
Styles holds the visual styles for CLI output.
func (*Styles) FormatAgentName ¶
FormatAgentName formats an agent name.
func (*Styles) FormatBadge ¶
FormatBadge formats a badge with the given variant.
func (*Styles) FormatHeader ¶
FormatHeader formats a table header.
func (*Styles) FormatMethod ¶
FormatMethod formats an installation method.
func (*Styles) FormatStatus ¶
FormatStatus formats a status indicator with color.
func (*Styles) FormatVersion ¶
FormatVersion formats a version string with color.
func (*Styles) InstalledIcon ¶
InstalledIcon returns the installed icon.
func (*Styles) NotInstalledIcon ¶
NotInstalledIcon returns the not installed icon.
func (*Styles) SuccessIcon ¶
SuccessIcon returns the success icon.
func (*Styles) UpdateIcon ¶
UpdateIcon returns the update available icon.
func (*Styles) WarningIcon ¶
WarningIcon returns the warning icon.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table handles aligned table output with ANSI color support.
func (*Table) SetHeaders ¶
SetHeaders sets the table headers.
func (*Table) SetPadding ¶
SetPadding sets the column padding.