Documentation
¶
Index ¶
- func Bulletf(marker, format string, args ...any)
- func ColorEnabled(w io.Writer) bool
- func Colorize(w io.Writer, s string, codes ...Color) string
- func Errorf(format string, args ...any)
- func Failuref(format string, args ...any)
- func Glyph(w io.Writer, r Role) string
- func Hintf(format string, args ...any)
- func Infof(format string, args ...any)
- func Printf(format string, args ...any)
- func ReportError(err error)
- func Section(title string)
- func SetColorMode(m ColorMode)
- func SetQuiet(q bool)
- func Successf(format string, args ...any)
- func Symbol(w io.Writer, r Role) string
- func Upgradedf(name, oldVersion, newVersion string)
- func Warnf(format string, args ...any)
- type Color
- type ColorMode
- type KeyValues
- type Role
- type Spinner
- type Table
- type Theme
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bulletf ¶ added in v0.6.0
Bulletf prints an indented list item to stdout. marker is a literal prefix (e.g. "+", "-", or "") so summaries can show add/remove glyphs. Infof-level.
func ColorEnabled ¶ added in v0.2.0
ColorEnabled reports whether ANSI color should be emitted to w, honoring the --color mode, the NO_COLOR convention, and TTY detection.
func Colorize ¶ added in v0.2.0
Colorize wraps s in ANSI escape sequences for the given colors when w is a terminal and NO_COLOR is unset; returns s unchanged otherwise.
func Errorf ¶
Errorf prints a fully red "✗ <msg>" line to stderr. Always emitted. Callers pass only the message; the marker and color are owned here.
func Glyph ¶ added in v0.7.0
Glyph returns the role's glyph colorized in its canonical color for writer w (e.g. a green "✓" or red "✗"), honoring the writer's color and unicode theme.
func ReportError ¶ added in v0.6.0
func ReportError(err error)
ReportError renders err to stderr in the house style:
- a cancelled context prints "Interrupted." and nothing else;
- a joined error (Unwrap() []error) prints "✗ <cause>" per line under a header;
- a report.Hinted appends a "→ <hint>" line.
func Section ¶ added in v0.6.0
func Section(title string)
Section prints a bold section title to stdout. Part of primary output, so it is not suppressed by --quiet (inspection output should always show).
func SetColorMode ¶ added in v0.6.0
func SetColorMode(m ColorMode)
SetColorMode records the global --color preference.
func Successf ¶ added in v0.6.0
Successf prints a green "✓ …" line to stdout. Infof-level (suppressed by -q).
Types ¶
type ColorMode ¶ added in v0.6.0
type ColorMode int
ColorMode overrides automatic TTY/NO_COLOR color detection. ColorAuto is the default.
func ParseColorMode ¶ added in v0.6.0
ParseColorMode maps a --color flag value to a ColorMode. Unknown values fall back to ColorAuto so a typo degrades rather than fails the command.
type KeyValues ¶ added in v0.6.0
type KeyValues struct {
// contains filtered or unexported fields
}
KeyValues renders aligned label/value pairs with bold labels.
func NewKeyValues ¶ added in v0.6.0
func NewKeyValues() *KeyValues
type Role ¶ added in v0.6.0
type Role int
Role identifies a semantic marker whose glyph adapts to the writer's theme.
type Spinner ¶ added in v0.6.0
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is an indeterminate activity indicator. On a TTY it animates a frame + label + elapsed counter in place; off-TTY (or under --quiet) it degrades to a start line and a terminal status line.
func NewSpinner ¶ added in v0.6.0
NewSpinner creates a spinner for label. Call Start, then exactly one of Stop or Fail.
type Theme ¶ added in v0.6.0
type Theme struct {
// contains filtered or unexported fields
}
Theme captures the resolved rendering capabilities for a single writer.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker renders multi-job download progress. On a TTY it owns the stdout cursor directly, repainting its block outside live.mu — unlike Spinner, which coordinates every repaint through it. It must therefore not animate while a Spinner is active or while other lines are written to a TTY; pkg.Manager upholds this by stopping the tracker before opening any install-phase spinner. Off a TTY it does no cursor painting at all — Update/Done/Fail emit plain lines instead — so the cursor-ownership invariant is a TTY-only concern.
func NewTracker ¶
func NewTracker() *Tracker