output

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTTY

func IsTTY() bool

IsTTY returns true if stdout is a terminal.

Types

type Formatter

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

Formatter handles JSON/human-readable output switching.

func NewFormatter

func NewFormatter(jsonMode, quiet bool) *Formatter

NewFormatter creates a formatter with the given output mode.

func (*Formatter) Error

func (f *Formatter) Error(format string, args ...any)

Error outputs an error message to stderr.

func (*Formatter) ErrorJSON

func (f *Formatter) ErrorJSON(err error) error

ErrorJSON outputs an error as JSON.

func (*Formatter) IsJSON

func (f *Formatter) IsJSON() bool

IsJSON returns true if the formatter is in JSON mode.

func (*Formatter) Print

func (f *Formatter) Print(data any) error

Print outputs data as JSON or human-readable text.

func (*Formatter) PrintJSON

func (f *Formatter) PrintJSON(data any) error

PrintJSON outputs data as formatted JSON.

func (*Formatter) Printf

func (f *Formatter) Printf(format string, args ...any)

Printf outputs formatted text (suppressed in quiet mode).

func (*Formatter) Println

func (f *Formatter) Println(args ...any)

Println outputs a line (suppressed in quiet mode).

Jump to

Keyboard shortcuts

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