Documentation
¶
Overview ¶
Package output provides colored terminal output functions.
Log-level functions (Status, Info, Debug, Verbose, DryRun, Warning, Error) delegate to the logging package for dual-write (terminal + file) support. Value styling functions (Name, Path, etc.) and raw Print/Println remain here.
Index ¶
- Variables
- func Bool(value bool) string
- func Command(value string) string
- func Debug(format string, args ...interface{})
- func DisableColors()
- func DryRun(format string, args ...interface{})
- func EnableColors()
- func Error(format string, args ...interface{})
- func Header(value string) string
- func Info(format string, args ...interface{})
- func IsDebug() bool
- func IsDefaultMode() bool
- func IsQuiet() bool
- func IsVerbose() bool
- func IsVeryVerbose() bool
- func Name(value string) string
- func Number(value string) string
- func Package(value string) string
- func Path(value string) string
- func Print(format string, args ...interface{})
- func Println(args ...interface{})
- func ReplaceStderr(w io.Writer) func()
- func ReplaceStdout(w io.Writer) func()
- func Result(format string, args ...interface{})
- func Status(format string, args ...interface{})
- func StopGlobalStatusLine()
- func Verbose(format string, args ...interface{})
- func Warning(format string, args ...interface{})
- type Spinner
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Debug ¶ added in v0.6.0
func Debug(format string, args ...interface{})
Debug prints a debug message with a faint [D] prefix.
func DisableColors ¶
func DisableColors()
DisableColors disables colored output for both value styling and logging prefixes.
func DryRun ¶ added in v0.6.0
func DryRun(format string, args ...interface{})
DryRun prints what would be executed with a cyan [dry-run] prefix. Stops the global status line first so the bubbletea inline renderer does not corrupt the log output on stdout.
func EnableColors ¶
func EnableColors()
EnableColors enables colored output for both value styling and logging prefixes.
func Error ¶
func Error(format string, args ...interface{})
Error prints an error message with a red [x] prefix. Stops the global status line first so the bubbletea inline renderer does not corrupt the log output on stderr.
func Info ¶
func Info(format string, args ...interface{})
Info prints an info message with a blue [i] prefix.
func IsDefaultMode ¶ added in v0.7.0
func IsDefaultMode() bool
IsDefaultMode returns true when the terminal log level is DefaultLevel.
func IsQuiet ¶ added in v0.6.0
func IsQuiet() bool
IsQuiet returns true if quiet mode is active (--quiet)
func IsVerbose ¶ added in v0.6.0
func IsVerbose() bool
IsVerbose returns true if at least verbose output is enabled (-v, -vv, or --debug)
func IsVeryVerbose ¶ added in v0.7.0
func IsVeryVerbose() bool
IsVeryVerbose returns true if very verbose output is enabled (-vv or --debug)
func Print ¶
func Print(format string, args ...interface{})
Print prints a plain message to stdout. Suppressed in quiet mode.
func Println ¶
func Println(args ...interface{})
Println prints a plain message to stdout with a newline. Suppressed in quiet mode.
func ReplaceStderr ¶
ReplaceStderr sets the package stderr to w and returns a restore func.
func ReplaceStdout ¶
ReplaceStdout sets the package stdout to w and returns a restore func. This is safe to use in tests concurrently.
func Result ¶ added in v0.8.0
func Result(format string, args ...interface{})
Result prints a message with a green [*] prefix. Unlike Status, it always renders on the terminal in default mode and does not route through the animated status line. Use for final command output rather than transient progress updates. Suppressed in quiet mode.
func Status ¶
func Status(format string, args ...interface{})
Status prints a status message with a green [*] prefix. In default mode on a TTY, it routes through the global status line.
func StopGlobalStatusLine ¶ added in v0.7.0
func StopGlobalStatusLine()
StopGlobalStatusLine is the exported entry point for stopping the status line from main.go and container.go.
Types ¶
type Spinner ¶ added in v0.6.0
type Spinner struct {
// contains filtered or unexported fields
}
Spinner wraps a bubbletea program with a bubbles/spinner component.
func NewSpinner ¶ added in v0.6.0
NewSpinner creates a spinner with a status message.
func StartSpinner ¶ added in v0.6.0
StartSpinner is a convenience that creates and starts a spinner. In default mode on a TTY, delegates to the global status line. In default mode without a TTY, returns a silent (no-op) spinner.
func (*Spinner) Start ¶ added in v0.6.0
func (s *Spinner) Start()
Start begins the spinner animation in a background goroutine. Degrades gracefully:
- Quiet mode: suppressed entirely
- Default mode, non-TTY: silent (no output)
- Verbose/debug mode, non-TTY: prints static "[*] message\n" (no animation)
- TTY + NO_COLOR: animated spinner without ANSI colors
- TTY: animated Braille dot spinner via bubbletea inline rendering
func (*Spinner) Stop ¶ added in v0.6.0
func (s *Spinner) Stop()
Stop halts the spinner and clears its line. Must be called before printing any follow-up status messages.
func (*Spinner) UpdateMessage ¶ added in v0.6.0
UpdateMessage changes the spinner text while running. Used for multi-phase operations (e.g., kernel install -> retry build).