Documentation
¶
Index ¶
- func ConfirmIdentifierTTY(in io.Reader, out io.Writer, identifier string) (bool, string, error)
- func ConfirmToken(s string) string
- func ConfirmYesTTY(in io.Reader, out io.Writer) (bool, string, error)
- func FormatPlanSummary(createCount, changeCount, destroyCount int) string
- func Italic(s string) string
- func RedText(s string) string
- func RenderNestedSections(sections []NestedSection) string
- func RenderSectionedList(sections []Section) string
- func SectionTitle(title string) string
- func StripANSI(s string) string
- func StripRedundantPrefixes(message, sectionType string) string
- func SuccessMark() string
- type ChangeType
- type DiffLine
- type NestedSection
- type NoopPrinter
- type Printer
- type Progress
- type Section
- type Spinner
- type StdPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmIdentifierTTY ¶ added in v0.2.0
ConfirmIdentifierTTY runs a Bubble Tea prompt that asks the user to type the provided identifier to confirm a destroy operation. 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 ConfirmToken ¶ added in v0.2.0
ConfirmToken renders a confirmation token (like "yes" or an identifier) in green, bold, italic.
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 FormatPlanSummary ¶ added in v0.1.1
FormatPlanSummary renders a plan summary with bold "Plan:" prefix.
func Italic ¶ added in v0.2.0
Italic renders the given string in italic style (used for resource and file names).
func RenderNestedSections ¶ added in v0.1.1
func RenderNestedSections(sections []NestedSection) string
RenderNestedSections renders sections that can contain nested subsections.
func RenderSectionedList ¶
RenderSectionedList renders sections with simple headers and two-space indented items.
func SectionTitle ¶
SectionTitle renders a bold section header for grouped output.
func StripRedundantPrefixes ¶ added in v0.1.1
StripRedundantPrefixes removes redundant "volume " and "network " prefixes from messages when they appear under their respective sections.
func SuccessMark ¶ added in v0.2.0
func SuccessMark() string
SuccessMark returns a green check mark for confirmations.
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 NestedSection ¶ added in v0.1.1
type NestedSection struct {
Title string
Items []DiffLine
Sections []NestedSection
}
NestedSection represents a section that can contain nested subsections.
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)