output

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source

Variables

View Source
var (
	Green  = color.New(color.FgGreen).SprintFunc()
	Red    = color.New(color.FgRed).SprintFunc()
	Yellow = color.New(color.FgYellow).SprintFunc()
	Cyan   = color.New(color.FgCyan).SprintFunc()
	Bold   = color.New(color.Bold).SprintFunc()
	Faint  = color.New(color.Faint).SprintFunc()
)
View Source
var Quiet bool

Quiet suppresses non-essential output when true

View Source
var Verbose bool

Verbose enables debug output when true

Functions

func AutoSizeColumns added in v0.5.0

func AutoSizeColumns(headers []string, rows [][]string, padding int, flexCols ...int)

AutoSizeColumns truncates flexible columns in-place to fit the terminal width. Fixed columns keep their natural width; the remaining space goes to flex columns.

func Debug

func Debug(format string, args ...any)

Debug prints debug info when verbose mode is enabled

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration in human-readable form

func Info

func Info(format string, args ...any)

Info prints an informational message (respects --quiet)

func Infof

func Infof(format string, args ...any)

Infof prints formatted info without newline (respects --quiet)

func IsStdinTerminal

func IsStdinTerminal() bool

IsStdinTerminal returns true if stdin is a terminal

func IsTerminal

func IsTerminal() bool

IsTerminal returns true if stdout is a terminal

func PlainStatusIcon

func PlainStatusIcon(status, state string) string

PlainStatusIcon returns a plain text status icon (for --plain output)

func PlainStatusText

func PlainStatusText(status, state string) string

PlainStatusText returns plain status text (for --plain output)

func PrintJSON

func PrintJSON(data any) error

PrintJSON prints data as JSON

func PrintLogo()

func PrintPlainTable

func PrintPlainTable(headers []string, rows [][]string, noHeader bool)

PrintPlainTable prints tab-separated output for scripting (works with cut -f, awk)

func PrintTable

func PrintTable(headers []string, rows [][]string)

PrintTable prints a formatted table with proper Unicode/ANSI handling

func RelativeTime

func RelativeTime(t time.Time) string

RelativeTime formats a time as relative to now

func StatusIcon

func StatusIcon(status, state string) string

StatusIcon returns a colored status icon

func StatusText

func StatusText(status, state string) string

StatusText returns colored status text

func Success

func Success(format string, args ...any)

Success prints a success message with green checkmark (respects --quiet)

func TerminalSize

func TerminalSize() (int, int)

TerminalSize returns terminal width and height (defaults: 80x24)

func TerminalWidth

func TerminalWidth() int

TerminalWidth returns the terminal width, or 80 as default

func Truncate

func Truncate(s string, maxLen int) string

Truncate truncates a string to maxLen display width, adding "..." if truncated Properly handles unicode and wide characters

func Warn

func Warn(format string, args ...any)

Warn prints a warning to stderr (respects --quiet)

func WithPager

func WithPager(fn func(w io.Writer))

WithPager pipes output through less if it exceeds terminal height

Types

This section is empty.

Jump to

Keyboard shortcuts

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