output

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 4 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"
	Cyan   = "\033[36m"
	Gray   = "\033[90m"
)

ANSI color and style constants.

Variables

View Source
var DefaultWriter = &Writer{Out: os.Stdout}

DefaultWriter is the default Writer targeting os.Stdout.

View Source
var ErrorWriter = &Writer{Out: os.Stderr}

ErrorWriter is the default Writer targeting os.Stderr.

Functions

func EndProgress

func EndProgress(msg string)

EndProgress prints a completion message to stdout.

func Error

func Error(msg string)

Error prints a red X followed by the message to stderr.

func Header(msg string)

Header prints a bold cyan header line to stdout.

func Info

func Info(msg string)

Info prints a blue info symbol followed by the message to stdout.

func PrintJSON

func PrintJSON(v any) error

PrintJSON marshals v as indented JSON and writes it to stdout.

func StartProgress

func StartProgress(msg string)

StartProgress prints a working indicator message to stdout.

func Success

func Success(msg string)

Success prints a green checkmark followed by the message to stdout.

func Warn

func Warn(msg string)

Warn prints a yellow warning symbol followed by the message to stdout.

Types

type Writer

type Writer struct {
	Out io.Writer
}

Writer wraps an io.Writer and provides styled terminal output helpers.

func (*Writer) EndProgress

func (w *Writer) EndProgress(msg string)

EndProgress prints a completion message.

func (*Writer) Error

func (w *Writer) Error(msg string)

Error prints a red X followed by the message.

func (*Writer) Header

func (w *Writer) Header(msg string)

Header prints a bold cyan header line.

func (*Writer) Info

func (w *Writer) Info(msg string)

Info prints a blue info symbol followed by the message.

func (*Writer) PrintJSON

func (w *Writer) PrintJSON(v any) error

PrintJSON marshals v as indented JSON and writes it to the writer.

func (*Writer) StartProgress

func (w *Writer) StartProgress(msg string)

StartProgress prints a working indicator message.

func (*Writer) Success

func (w *Writer) Success(msg string)

Success prints a green checkmark followed by the message.

func (*Writer) Warn

func (w *Writer) Warn(msg string)

Warn prints a yellow warning symbol followed by the message.

Jump to

Keyboard shortcuts

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