output

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTTY

func IsTTY(f *os.File) bool

IsTTY returns true if the given file descriptor is a terminal.

func PrintError

func PrintError(w *Writers, format string, args ...any)

PrintError writes an error message to stderr.

Types

type Formatter

type Formatter interface {
	Format(data any) error
}

Formatter defines how to render output.

type JSONFormatter

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

JSONFormatter outputs data as JSON.

func NewJSONFormatter

func NewJSONFormatter(w io.Writer) *JSONFormatter

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(data any) error

type TableFormatter

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

TableFormatter outputs data as an ASCII table.

func NewTableFormatter

func NewTableFormatter(w io.Writer) *TableFormatter

func (*TableFormatter) Format

func (f *TableFormatter) Format(data any) error

type Writers

type Writers struct {
	Out io.Writer
	Err io.Writer
}

Writers holds the stdout and stderr writers.

func DefaultWriters

func DefaultWriters() *Writers

Jump to

Keyboard shortcuts

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