printer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorReset = "\033[0m"
	ColorRed   = "\033[38;2;215;95;107m"  // #d75f6b
	ColorGreen = "\033[38;2;34;197;94m"   // #22c55e
	ColorGray  = "\033[38;2;163;163;163m" // #a3a3a3
	ColorBold  = "\033[1m"
)

ANSI color codes

View Source
const (
	Check  = "✔"
	Cross  = "✘"
	Folder = ""
	Dot    = "•"
)

Symbols

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, p *Printer) context.Context

NewContext returns a context with the printer attached

Types

type Printer

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

Printer handles formatted output with colors and styles

func Ctx

func Ctx(ctx context.Context) *Printer

Ctx retrieves the printer from context, or creates a default one

func New

func New(w io.Writer) *Printer

New creates a new Printer that writes to the given writer

func (*Printer) Bold

func (p *Printer) Bold(text string) string

Bold makes text bold

func (*Printer) Errorf

func (p *Printer) Errorf(format string, args ...interface{})

Errorf prints an error message in red

func (*Printer) FatalError

func (p *Printer) FatalError(err error)

FatalError prints a formatted error box and does NOT exit Caller should handle exit code

func (*Printer) Infof

func (p *Printer) Infof(format string, args ...interface{})

Infof prints an info message in gray

func (*Printer) Printlnf

func (p *Printer) Printlnf(format string, args ...interface{})

Printlnf prints a plain message without colors

func (*Printer) Successf

func (p *Printer) Successf(format string, args ...interface{})

Successf prints a success message in green

Jump to

Keyboard shortcuts

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