ioutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvColorDisabled

func EnvColorDisabled() bool

func EnvColorForced

func EnvColorForced() bool

func IsTerminal

func IsTerminal(stream IOStream) bool

IsTerminal returns true if the stream is a terminal.

Types

type ColorFunc

type ColorFunc func(string) string

type Formatter

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

Formatter wraps strings in ANSI escape sequences.

func NewFormatter

func NewFormatter(enabled bool) *Formatter

func (*Formatter) Blue

func (f *Formatter) Blue(t string) string

func (*Formatter) Bluef

func (f *Formatter) Bluef(t string, args ...interface{}) string

func (*Formatter) Bold

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

func (*Formatter) Boldf

func (f *Formatter) Boldf(t string, args ...interface{}) string

func (*Formatter) ColorFromString

func (f *Formatter) ColorFromString(s string) ColorFunc

func (*Formatter) Cyan

func (f *Formatter) Cyan(t string) string

func (*Formatter) Cyanf

func (f *Formatter) Cyanf(t string, args ...interface{}) string

func (*Formatter) Failure

func (f *Formatter) Failure(t string) string

func (*Formatter) FailureIcon

func (f *Formatter) FailureIcon() string

func (*Formatter) Gray

func (f *Formatter) Gray(t string) string

func (*Formatter) Grayf

func (f *Formatter) Grayf(t string, args ...interface{}) string

func (*Formatter) Green

func (f *Formatter) Green(t string) string

func (*Formatter) Greenf

func (f *Formatter) Greenf(t string, args ...interface{}) string

func (*Formatter) Info

func (f *Formatter) Info(t string) string

func (*Formatter) InfoIcon

func (f *Formatter) InfoIcon() string

func (*Formatter) Magenta

func (f *Formatter) Magenta(t string) string

func (*Formatter) Magentaf

func (f *Formatter) Magentaf(t string, args ...interface{}) string

func (*Formatter) Red

func (f *Formatter) Red(t string) string

func (*Formatter) Redf

func (f *Formatter) Redf(t string, args ...interface{}) string

func (*Formatter) Success

func (f *Formatter) Success(t string) string

func (*Formatter) SuccessIcon

func (f *Formatter) SuccessIcon() string

func (*Formatter) Warning

func (f *Formatter) Warning(t string) string

func (*Formatter) WarningIcon

func (f *Formatter) WarningIcon() string

func (*Formatter) Yellow

func (f *Formatter) Yellow(t string) string

func (*Formatter) Yellowf

func (f *Formatter) Yellowf(t string, args ...interface{}) string

type IOStream

type IOStream interface {
	io.Reader
	io.Writer
	Fd() uintptr
	String() string
	Lines() []string
}

IOStream represents an input or output stream.

type IOStreams

type IOStreams struct {
	// os.Stdin (or mock when unit testing)
	In IOStream
	// os.Stdout (or mock when unit testing)
	Out IOStream
	// os.Stderr (or mock when unit testing)
	Err IOStream
	// contains filtered or unexported fields
}

Container for the three main CLI I/O streams.

func System

func System() *IOStreams

Returns an IOStreams containing os.Stdin, os.Stdout, and os.Stderr.

func Test

func Test() *IOStreams

Returns an IOStreams with mock in/out/err values.

func (*IOStreams) Formatter

func (s *IOStreams) Formatter() *Formatter

Formatter returns a ANSI string formatter.

func (*IOStreams) IsColorEnabled

func (s *IOStreams) IsColorEnabled() bool

IsColorEnabled returns true if color output is enabled.

func (*IOStreams) IsInteractive

func (s *IOStreams) IsInteractive() bool

IsInteractive returns true if running interactively. Will be false if either (a) std in/out is not a TTY, or (b) the user has explicitly requested not to be prompted.

func (*IOStreams) IsStderrTTY

func (s *IOStreams) IsStderrTTY() bool

IsStderrTTY returns true if [IOStreams.Err] is a TTY.

func (*IOStreams) IsStdinTTY

func (s *IOStreams) IsStdinTTY() bool

IsStdinTTY returns true if [IOStreams.In] is a TTY.

func (*IOStreams) IsStdoutTTY

func (s *IOStreams) IsStdoutTTY() bool

IsStdoutTTY returns true if [IOStreams.Out] is a TTY.

func (*IOStreams) ProgressIndicatorEnabled

func (s *IOStreams) ProgressIndicatorEnabled() bool

ProgressIndicatorEnabled returns true if the progress indicator is enabled.

func (*IOStreams) SetColorEnabled

func (s *IOStreams) SetColorEnabled(v bool)

SetColorEnabled sets whether color is enabled.

func (*IOStreams) SetInteractive

func (s *IOStreams) SetInteractive(v bool)

SetInteractive explicitly sets whether this is an interactive session.

func (*IOStreams) SetProgressIndicatorEnabled

func (s *IOStreams) SetProgressIndicatorEnabled(v bool)

SetProgressIndicatorEnabled sets whether the progress indicator is enabled.

func (*IOStreams) SetStderrTTY

func (s *IOStreams) SetStderrTTY(isTTY bool)

SetStderrTTY explicitly flags [IOStreams.Err] as a TTY.

func (*IOStreams) SetStdinTTY

func (s *IOStreams) SetStdinTTY(isTTY bool)

SetStdinTTY explicitly flags [IOStreams.In] as a TTY.

func (*IOStreams) SetStdoutTTY

func (s *IOStreams) SetStdoutTTY(isTTY bool)

SetStdoutTTY explicitly flags [IOStreams.Out] as a TTY.

func (*IOStreams) StartProgressIndicator

func (s *IOStreams) StartProgressIndicator()

func (*IOStreams) StartProgressIndicatorWithLabel

func (s *IOStreams) StartProgressIndicatorWithLabel(label string)

func (*IOStreams) StopProgressIndicator

func (s *IOStreams) StopProgressIndicator()

Jump to

Keyboard shortcuts

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