Documentation
¶
Overview ¶
Package term decides what the CLI may do with the user's terminal: is a stream a TTY, may it carry color, may we prompt. Every package asks here instead of calling isatty itself, so NO_COLOR, CLICOLOR=0 and --no-color are honored everywhere at once.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶
IsTerminal reports whether w is a terminal. Writers that aren't files (test buffers, captured output) are not.
func NoColor ¶
func NoColor() bool
NoColor reports whether color is switched off: --no-color, a non-empty NO_COLOR (https://no-color.org) or CLICOLOR=0.
func QR ¶ added in v0.18.0
QR renders text as a QR code for a terminal: two modules per character row with half-block glyphs, black on a forced white background (ANSI colors) inside the quiet zone scanners need, so it scans the same on dark and light terminal themes. It returns "" when the code can't be encoded or wouldn't fit in maxWidth columns. Callers only use it when colors are on: without them the code could come out inverted.
func StderrIsTerminal ¶
func StderrIsTerminal() bool
StderrIsTerminal reports whether progress, spinners and hints meant for a person may be written to stderr.
func StdinIsTerminal ¶
func StdinIsTerminal() bool
StdinIsTerminal reports whether the CLI may prompt: stdin is a terminal.