Documentation
¶
Index ¶
- Variables
- func ConfirmYesTTY(in io.Reader, out io.Writer) (bool, string, error)
- func RenderSectionedList(sections []Section) string
- func SectionTitle(title string) string
- func StripANSI(s string) string
- type ChangeType
- type DiffLine
- type NoopPrinter
- type Printer
- type Progress
- type Section
- type Spinner
- type StdPrinter
Constants ¶
This section is empty.
Variables ¶
var ListStyles = struct { OuterEnumStyle lipgloss.Style OuterItemStyle lipgloss.Style InnerEnumStyle lipgloss.Style InnerItemStyle lipgloss.Style }{ OuterEnumStyle: lipgloss.NewStyle(), OuterItemStyle: lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("69")).MarginTop(1), InnerEnumStyle: lipgloss.NewStyle(), InnerItemStyle: lipgloss.NewStyle(), }
ListStyles centralizes lipgloss list styles for consistent UX.
Functions ¶
func ConfirmYesTTY ¶
ConfirmYesTTY runs a Bubble Tea prompt that asks the user to type "yes" to confirm. It renders only when attached to a TTY via tea.WithInput/WithOutput provided by the caller. It returns whether the user confirmed and the raw value that was entered.
func RenderSectionedList ¶
RenderSectionedList renders sections as a nested lipgloss list with configured styles.
func SectionTitle ¶
SectionTitle renders a bold section header for grouped output.
Types ¶
type ChangeType ¶
type ChangeType int
const ( Info ChangeType = iota Noop ChangeType = iota Add Remove Change )
type DiffLine ¶
type DiffLine struct {
Type ChangeType
Message string
}
type NoopPrinter ¶
type NoopPrinter struct{}
NoopPrinter discards all output; useful as a default or in tests.
func (NoopPrinter) Error ¶
func (NoopPrinter) Error(string, ...any)
func (NoopPrinter) Info ¶
func (NoopPrinter) Info(string, ...any)
func (NoopPrinter) Plain ¶
func (NoopPrinter) Plain(string, ...any)
func (NoopPrinter) Warn ¶
func (NoopPrinter) Warn(string, ...any)
type Printer ¶
type Printer interface {
// Plain writes to stdout without any prefix or styling.
Plain(format string, a ...any)
// Info writes to stdout with an [info] prefix.
Info(format string, a ...any)
// Warn writes to stderr with a [warn] prefix.
Warn(format string, a ...any)
// Error writes to stderr with an [error] prefix.
Error(format string, a ...any)
}
Printer centralizes user-facing output. It routes informational messages to stdout and warnings/errors to stderr, ready for future styling via lipgloss.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress renders a simple in-place progress bar to a TTY. When the output is not a terminal, it is disabled and all methods become no-ops.
func NewProgress ¶
NewProgress creates a new progress bar writer targeting out with a label. The bar only renders if out is a TTY.
func (*Progress) AdjustTotal ¶
AdjustTotal changes the total by delta (can be negative) and re-renders.
func (*Progress) Increment ¶
func (p *Progress) Increment()
Increment adds one to the current progress and re-renders.
func (*Progress) SetAction ¶
SetAction sets the action text shown under the progress bar and re-renders.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner renders a simple TTY spinner with an optional label. It is disabled automatically when the writer is not a terminal.
func NewSpinner ¶
NewSpinner creates a new spinner that writes to out with the given label. The spinner only animates if out is a TTY; otherwise Start/Stop are no-ops.
type StdPrinter ¶
StdPrinter writes Info to Out and Warn/Error to Err.
func (StdPrinter) Error ¶
func (p StdPrinter) Error(format string, a ...any)
func (StdPrinter) Info ¶
func (p StdPrinter) Info(format string, a ...any)
func (StdPrinter) Plain ¶
func (p StdPrinter) Plain(format string, a ...any)
func (StdPrinter) Warn ¶
func (p StdPrinter) Warn(format string, a ...any)