output

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(msg string)

Error prints an error message to stderr.

func Info

func Info(msg string)

Info prints an info message to stderr.

func IsTTY

func IsTTY() bool

IsTTY returns true if stderr is a terminal (for spinner decisions).

func Print

func Print(format Format, data any, headers []any, rows [][]any) error

Print outputs data in the specified format. For table format, provide headers and rows. For json/yaml, data is serialized directly.

func Success

func Success(msg string)

Success prints a success message to stderr.

Types

type Format

type Format string

Format represents an output format.

const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
	FormatYAML  Format = "yaml"
)

func ParseFormat

func ParseFormat(s string) Format

ParseFormat parses a format string, defaulting to table.

type TTYSpinner

type TTYSpinner struct {
	// contains filtered or unexported fields
}

TTYSpinner wraps spinner.Spinner with transparent TTY detection. All methods are no-ops when not running in a TTY.

func NewSpinner

func NewSpinner(suffix string) *TTYSpinner

NewSpinner creates a TTYSpinner with the given suffix. The underlying spinner is only initialised when output is a TTY.

func (*TTYSpinner) Start

func (t *TTYSpinner) Start()

Start starts the spinner. No-op when not a TTY.

func (*TTYSpinner) Stop

func (t *TTYSpinner) Stop()

Stop stops the spinner. No-op when not a TTY.

func (*TTYSpinner) Suffix

func (t *TTYSpinner) Suffix(suffix string)

Suffix updates the spinner suffix text. No-op when not a TTY.

Jump to

Keyboard shortcuts

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