Documentation
¶
Overview ¶
Package output provides color-aware terminal output utilities for SSU.
Color definitions are centralized here. fatih/color handles NO_COLOR, TERM=dumb, and non-TTY detection automatically -- no custom logic needed.
Index ¶
- Constants
- Variables
- func ForceDisableColor()
- func IsColorEnabled() bool
- func IsTTY() bool
- type Printer
- func (p *Printer) Error(msg string)
- func (p *Printer) Errorf(format string, args ...any)
- func (p *Printer) Info(msg string)
- func (p *Printer) Infof(format string, args ...any)
- func (p *Printer) Success(msg string)
- func (p *Printer) Successf(format string, args ...any)
- func (p *Printer) Warning(msg string)
- func (p *Printer) Warningf(format string, args ...any)
Constants ¶
const ( Check = "\u2713" // checkmark Cross = "\u2717" // ballot x Arrow = "\u2192" // rightwards arrow Bullet = "\u25CF" // black circle Pipe = "\u2502" // box drawings light vertical Ellipsis = "\u2026" // horizontal ellipsis )
Unicode symbol constants for terminal output. These are plain strings -- callers apply color via the output package.
Variables ¶
var ( Success = color.New(color.FgGreen) Error = color.New(color.FgRed) Warning = color.New(color.FgYellow) Info = color.New(color.FgCyan) Muted = color.New(color.FgHiBlack) // Gray for secondary text Bold = color.New(color.Bold) )
General-purpose colors.
var ( Pending = color.New(color.FgGreen) // Submodule needs update Current = color.New(color.FgCyan) // Up to date Modified = color.New(color.FgYellow) // Has local changes Ahead = color.New(color.FgMagenta) // Unpushed commits Conflict = color.New(color.FgRed) // Merge conflict )
Status-specific colors matching the bash version semantics.
Functions ¶
func ForceDisableColor ¶
func ForceDisableColor()
ForceDisableColor explicitly turns off all color output.
func IsColorEnabled ¶
func IsColorEnabled() bool
IsColorEnabled returns whether color output is active. fatih/color handles NO_COLOR, TERM=dumb, and non-TTY automatically.
Types ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer provides formatted output helpers with color and symbols. It respects whatever color state fatih/color is in (NO_COLOR, TTY detection happen at the fatih/color level, not here).
func NewPrinter ¶
NewPrinter creates a Printer that writes to w.