Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Stderr = NewAtomicWriter(os.Stderr)
Stderr is the shared, mutable writer for user-facing standard error output.
It defaults to os.Stderr. Higher-level UIs (e.g. progress UI) may redirect it to a UI-managed writer to keep terminal rendering stable.
var Stdout = NewAtomicWriter(os.Stdout)
Stdout is the shared, mutable writer for user-facing standard output.
It defaults to os.Stdout. Higher-level UIs (e.g. progress UI) may redirect it to a UI-managed writer to keep terminal rendering stable.
Functions ¶
This section is empty.
Types ¶
type AtomicWriter ¶
type AtomicWriter struct {
// contains filtered or unexported fields
}
AtomicWriter is a goroutine-safe, mutable reference to an io.Writer.
It is useful for packages that need to emit user-facing output but also want to cooperate with a higher-level UI that may redirect output to a managed writer (e.g. a progress UI that has to keep terminal rendering stable).
AtomicWriter stores a wrapper type in sync/atomic.Value to avoid the common panic caused by storing interface values of different concrete types (e.g. *os.File vs *bytes.Buffer).
func NewAtomicWriter ¶
func NewAtomicWriter(fallback io.Writer) *AtomicWriter
NewAtomicWriter creates an AtomicWriter with a fallback writer.
If fallback is nil, it defaults to io.Discard.
func (*AtomicWriter) Get ¶
func (aw *AtomicWriter) Get() io.Writer
Get returns the current writer (or the fallback writer if none is set).
func (*AtomicWriter) Set ¶
func (aw *AtomicWriter) Set(w io.Writer)
Set sets the current writer.
If w is nil, it resets back to the fallback writer.
type Callout ¶
type Callout struct {
Style CalloutStyle
StatusText string
Content string
}
Callout renders a small status+content block.
In color mode, it uses lipgloss to render ANSI styles (no borders). When color is disabled, it emits plain text.
type CalloutStyle ¶
type CalloutStyle int
CalloutStyle selects the visual style used by Callout.
const ( // CalloutDefault is the default callout style. CalloutDefault CalloutStyle = iota // CalloutSucceeded is the success callout style. CalloutSucceeded // CalloutWarning is the warning callout style. CalloutWarning // CalloutFailed is the failure callout style. CalloutFailed )
type Labels ¶
type Labels struct {
Rows [][2]string
// LabelWidth pads the label column to the given width.
// When 0, it is computed from Rows.
LabelWidth int
// Gap is the number of spaces between the two columns.
// When 0, it defaults to 1.
Gap int
}
Labels renders aligned two-column text (label/value pairs).
When color is enabled, the label column is styled as dark gray and the value column keeps the default terminal style.
The value column is intentionally not width-constrained. Long values (e.g. URLs) are expected to wrap naturally by the terminal.