iostreams

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 5 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"
	White      = "\033[37m"
	BoldRed    = "\033[1;31m"
	BoldGreen  = "\033[1;32m"
	BoldYellow = "\033[1;33m"
	BoldBlue   = "\033[1;34m"
)

Color codes

Variables

This section is empty.

Functions

This section is empty.

Types

type IOStreams

type IOStreams struct {
	In     io.Reader
	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

IOStreams provides access to standard input/output streams

func New

func New() *IOStreams

New creates a new IOStreams with default stdin/stdout/stderr

func (*IOStreams) ColorEnabled

func (s *IOStreams) ColorEnabled() bool

ColorEnabled returns true if color output is enabled

func (*IOStreams) ColorFunc

func (s *IOStreams) ColorFunc(color string) func(string) string

ColorFunc returns a function that wraps text in color codes if color is enabled

func (*IOStreams) Error

func (s *IOStreams) Error(format string, a ...interface{})

Error prints an error message (red X)

func (*IOStreams) Info

func (s *IOStreams) Info(format string, a ...interface{})

Info prints an info message

func (*IOStreams) Is256ColorEnabled

func (s *IOStreams) Is256ColorEnabled() bool

Is256ColorEnabled returns true if 256-color output is enabled

func (*IOStreams) IsStderrTTY

func (s *IOStreams) IsStderrTTY() bool

IsStderrTTY returns true if stderr is a terminal

func (*IOStreams) IsStdinTTY

func (s *IOStreams) IsStdinTTY() bool

IsStdinTTY returns true if stdin is a terminal

func (*IOStreams) IsStdoutTTY

func (s *IOStreams) IsStdoutTTY() bool

IsStdoutTTY returns true if stdout is a terminal

func (*IOStreams) Success

func (s *IOStreams) Success(format string, a ...interface{})

Success prints a success message (green checkmark)

func (*IOStreams) TerminalWidth

func (s *IOStreams) TerminalWidth() int

TerminalWidth returns the width of the terminal, or 80 if not a terminal

func (*IOStreams) Warning

func (s *IOStreams) Warning(format string, a ...interface{})

Warning prints a warning message (yellow !)

Jump to

Keyboard shortcuts

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