output

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset   = "\033[0m"
	Bold    = "\033[1m"
	Red     = "\033[31m"
	Green   = "\033[32m"
	Yellow  = "\033[33m"
	Blue    = "\033[34m"
	Magenta = "\033[35m"
	Cyan    = "\033[36m"
	Gray    = "\033[90m"
)

ANSI color codes

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	JSON    bool
	Verbose bool
	Quiet   bool
	NoColor bool
	Writer  io.Writer
}

func New

func New(jsonOutput, verbose, quiet, noColor bool) *Formatter

func (*Formatter) Bold

func (f *Formatter) Bold(text string) string

Bold wraps text in bold if colors are enabled

func (*Formatter) Color

func (f *Formatter) Color(color, text string) string

Color wraps text in ANSI color codes if colors are enabled

func (*Formatter) Error

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

func (*Formatter) ErrorText

func (f *Formatter) ErrorText(text string) string

Error color (red)

func (*Formatter) InfoText

func (f *Formatter) InfoText(text string) string

Info color (cyan)

func (*Formatter) MutedText

func (f *Formatter) MutedText(text string) string

Muted color (gray)

func (*Formatter) NewTable

func (f *Formatter) NewTable(headers ...string) *TableWriter

func (*Formatter) Print

func (f *Formatter) Print(v interface{}) error

func (*Formatter) PrintError

func (f *Formatter) PrintError(err error)

func (*Formatter) PrintJSON

func (f *Formatter) PrintJSON(v interface{}) error

func (*Formatter) PrintSuccess

func (f *Formatter) PrintSuccess(message string)

func (*Formatter) Success

func (f *Formatter) Success(data interface{}) error

func (*Formatter) SuccessText

func (f *Formatter) SuccessText(text string) string

Success color (green)

func (*Formatter) Verbosef

func (f *Formatter) Verbosef(format string, args ...interface{})

func (*Formatter) WarningText

func (f *Formatter) WarningText(text string) string

Warning color (yellow)

type JSONResponse

type JSONResponse struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
	Error   string      `json:"error,omitempty"`
	Message string      `json:"message,omitempty"`
}

type TableWriter

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

func (*TableWriter) AddRow

func (t *TableWriter) AddRow(values ...string)

func (*TableWriter) Flush

func (t *TableWriter) Flush()

Jump to

Keyboard shortcuts

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