cliutil

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bold

func Bold(s string) string

Bold returns text with bold formatting.

func BoldGreen added in v0.1.3

func BoldGreen(s string) string

BoldGreen returns text with bold+green formatting for inline diff emphasis.

func BoldRed added in v0.1.3

func BoldRed(s string) string

BoldRed returns text with bold+red formatting for inline diff emphasis.

func Error

func Error(s string) string

Error returns text formatted as error.

func FormatStatus

func FormatStatus(status int) string

FormatStatus returns a colored status code string.

func Hint

func Hint(w io.Writer, message string)

Hint prints a muted hint message.

func HintCommand

func HintCommand(w io.Writer, desc, cmd string)

HintCommand prints a command suggestion with description.

func ID

func ID(s string) string

ID returns text formatted as an identifier.

func Muted

func Muted(s string) string

Muted returns text with faint/dim formatting.

func NewTable

func NewTable(w io.Writer) table.Writer

NewTable creates a new styled table writer. If w is nil, uses os.Stdout.

func NoResults

func NoResults(w io.Writer, message string)

NoResults prints a "no results" message.

func StatusColor

func StatusColor(status int) text.Color

StatusColor returns the appropriate color for an HTTP status code.

func StatusRowPainter

func StatusRowPainter(statusColIdx int) func(row table.Row) text.Colors

StatusRowPainter returns a row painter function that colors rows based on HTTP status. statusColIdx is the 0-based index of the status column in the row.

func StyleLight

func StyleLight() table.Style

StyleLight returns the primary table style with Unicode box-drawing characters.

func StyleSimple

func StyleSimple() table.Style

StyleSimple returns a plain ASCII style for non-TTY output.

func Success

func Success(s string) string

Success returns text formatted as success.

func Summary

func Summary(w io.Writer, count int, singular, plural string)

Summary prints a count summary line.

func UnknownCommandError

func UnknownCommandError(unknown string, validCommands []string) error

UnknownCommandError returns an error for an unknown command with a "did you mean" suggestion if a close match is found.

func UnknownSubcommandError

func UnknownSubcommandError(prefix, unknown string, validCommands []string) error

UnknownSubcommandError returns an error for an unknown subcommand with a "did you mean" suggestion if a close match is found.

func Warning

func Warning(s string) string

Warning returns text formatted as warning.

Types

type ColorMode

type ColorMode int
const (
	ColorAuto ColorMode = iota // auto-detect based on TTY
	ColorAlways
	ColorNever
)

type OutputConfig

type OutputConfig struct {
	Writer    io.Writer
	ColorMode ColorMode
}
var Output *OutputConfig

func (*OutputConfig) ColorsEnabled

func (o *OutputConfig) ColorsEnabled() bool

func (*OutputConfig) IsTTY

func (o *OutputConfig) IsTTY() bool

IsTTY returns true if output should be formatted for a terminal.

Jump to

Keyboard shortcuts

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