output

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	FormatTable  = "table"
	FormatJSON   = "json"
	FormatPretty = "pretty"
)

Format types

View Source
const SensitiveOverlay = "********"

SensitiveOverlay is the string used to hide sensitive information

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	// Format formats the data and writes it to the writer
	Format(data interface{}) error
}

Formatter is the interface for output formatting

func NewFormatter

func NewFormatter(format string, opts Options) (Formatter, error)

NewFormatter creates a formatter based on the format type

type JSONFormatter

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

JSONFormatter formats output as compact JSON

func NewJSONFormatter

func NewJSONFormatter(opts Options) *JSONFormatter

NewJSONFormatter creates a new JSON formatter

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(data interface{}) error

Format formats the data as compact JSON

type Options

type Options struct {
	Writer        io.Writer
	ShowSensitive bool
	Color         bool
}

Options for formatter configuration

type PrettyFormatter

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

PrettyFormatter formats output as indented JSON

func NewPrettyFormatter

func NewPrettyFormatter(opts Options) *PrettyFormatter

NewPrettyFormatter creates a new pretty JSON formatter

func (*PrettyFormatter) Format

func (f *PrettyFormatter) Format(data interface{}) error

Format formats the data as indented JSON

type TableFormatter

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

TableFormatter formats output as a table

func NewTableFormatter

func NewTableFormatter(opts Options) *TableFormatter

NewTableFormatter creates a new table formatter

func (*TableFormatter) Format

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

Jump to

Keyboard shortcuts

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