iostream

package
v0.7.61 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintJSON added in v0.7.49

func PrintJSON(w io.Writer, v any) error

PrintJSON writes v to w as indented JSON followed by a newline.

Types

type Level added in v0.7.28

type Level int

Level indicates the kind of status message.

const (
	LevelStep Level = iota // numbered step heading (e.g. "Step 1/3: Discovering...")
	LevelInfo              // dim informational detail
	LevelWarn              // yellow warning
	LevelDone              // green success/completion
)

Status levels for progress reporting.

type StatusFunc added in v0.7.28

type StatusFunc func(level Level, msg string)

StatusFunc is a callback for reporting progress from business logic. Business logic calls this instead of importing ui directly.

type Streams

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

Streams bundles the standard output and error writers. Out is for results (data a script would consume). Err is for status, progress, and warnings.

func FromCmd

func FromCmd(cmd *cobra.Command) Streams

FromCmd creates Streams from a cobra command's configured writers.

func (Streams) ErrPrintf

func (s Streams) ErrPrintf(format string, a ...any)

func (Streams) ErrPrintln

func (s Streams) ErrPrintln(a ...any)

func (Streams) Printf

func (s Streams) Printf(format string, a ...any)

func (Streams) Println

func (s Streams) Println(a ...any)

Jump to

Keyboard shortcuts

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