Help us shape the future of Go! Take the 2026 Go Developer Survey

output

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package output holds the terminal helpers the commands print with: the color palette, status and package formatting, and terminal detection that turns color off when stdout is not a terminal or NO_COLOR is set.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Status colors
	Added     = color.New(color.FgGreen)
	Modified  = color.New(color.FgYellow)
	Deleted   = color.New(color.FgRed)
	Renamed   = color.New(color.FgCyan)
	Untracked = color.New(color.FgMagenta)

	// Message colors
	Success = color.New(color.FgGreen)
	Warning = color.New(color.FgYellow)
	Error   = color.New(color.FgRed)
	Info    = color.New(color.FgCyan)
	Dim     = color.New(color.Faint)

	// Structural colors
	Header  = color.New(color.FgWhite, color.Bold)
	Package = color.New(color.FgBlue, color.Bold)
)

Functions

func Box

func Box(title, content string)

Box prints a boxed message

func ForceColor

func ForceColor()

ForceColor enables color output even when not a TTY

func FormatPackage

func FormatPackage(category, pkg string) string

FormatPackage formats a package name with color

func FormatStatus

func FormatStatus(status string) string

FormatStatus formats a status string with appropriate color

func IsTerminal

func IsTerminal() bool

IsTerminal returns true if stdout is a terminal

func NoColor

func NoColor()

NoColor disables color output

func PrintError

func PrintError(format string, args ...interface{})

PrintError prints an error message

func PrintInfo

func PrintInfo(format string, args ...interface{})

PrintInfo prints an info message

func PrintSuccess

func PrintSuccess(format string, args ...interface{})

PrintSuccess prints a success message

func PrintWarning

func PrintWarning(format string, args ...interface{})

PrintWarning prints a warning message

func Printf

func Printf(c *color.Color, format string, args ...interface{})

Printf prints with color

func Println

func Println(c *color.Color, a ...interface{})

Println prints with color and newline

func Sprint

func Sprint(c *color.Color, a ...interface{}) string

Sprint returns a colored string without printing

func Sprintf

func Sprintf(c *color.Color, format string, args ...interface{}) string

Sprintf returns a colored string without printing

func StatusColor

func StatusColor(status string) *color.Color

StatusColor returns the appropriate color for a git status

Types

This section is empty.

Jump to

Keyboard shortcuts

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