outputtools

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdout io.Writer = os.Stdout
	Stderr io.Writer = os.Stderr
)

Stdout and Stderr are the CLI's two output sinks. Everything the CLI prints goes through one of them — the colored helpers below, and the raw fmt.Fprint* calls in the command packages — so a test can capture a whole command's output by swapping them, and production keeps writing to the real file descriptors.

Package-level rather than plumbed through every signature because the printing sites are spread across ~40 call sites in a single linear pipeline; swapping two variables is the seam, and it defaults to exactly what the CLI did before. Tests that swap them must restore them (and must not run in parallel).

Functions

func GetLocale

func GetLocale() string

func PrintlnColored

func PrintlnColored(text string, color OutputColor)

func PrintlnColoredErr added in v1.0.0

func PrintlnColoredErr(text string, color OutputColor)

PrintlnColoredErr writes a colored line to stderr. Use it for progress/status messages so that stdout stays clean for machine-readable (--json) output.

Types

type OutputColor

type OutputColor int32
const (
	Reset   OutputColor = 0
	Red     OutputColor = 31
	Green   OutputColor = 32
	Yellow  OutputColor = 33
	Blue    OutputColor = 34
	Magenta OutputColor = 35
	Cyan    OutputColor = 36
	Gray    OutputColor = 37
	White   OutputColor = 97
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL