Documentation ¶
Index ¶
- func EnvColorDisabled() bool
- func EnvColorForced() bool
- func IsTerminal(stream IOStream) bool
- type ColorFunc
- type Formatter
- func (f *Formatter) Blue(t string) string
- func (f *Formatter) Bluef(t string, args ...interface{}) string
- func (f *Formatter) Bold(t string) string
- func (f *Formatter) Boldf(t string, args ...interface{}) string
- func (f *Formatter) ColorFromString(s string) ColorFunc
- func (f *Formatter) Cyan(t string) string
- func (f *Formatter) Cyanf(t string, args ...interface{}) string
- func (f *Formatter) Failure(t string) string
- func (f *Formatter) FailureIcon() string
- func (f *Formatter) Gray(t string) string
- func (f *Formatter) Grayf(t string, args ...interface{}) string
- func (f *Formatter) Green(t string) string
- func (f *Formatter) Greenf(t string, args ...interface{}) string
- func (f *Formatter) Info(t string) string
- func (f *Formatter) InfoIcon() string
- func (f *Formatter) Magenta(t string) string
- func (f *Formatter) Magentaf(t string, args ...interface{}) string
- func (f *Formatter) Red(t string) string
- func (f *Formatter) Redf(t string, args ...interface{}) string
- func (f *Formatter) Success(t string) string
- func (f *Formatter) SuccessIcon() string
- func (f *Formatter) Warning(t string) string
- func (f *Formatter) WarningIcon() string
- func (f *Formatter) Yellow(t string) string
- func (f *Formatter) Yellowf(t string, args ...interface{}) string
- type IOStream
- type IOStreams
- func (s *IOStreams) Formatter() *Formatter
- func (s *IOStreams) IsColorEnabled() bool
- func (s *IOStreams) IsInteractive() bool
- func (s *IOStreams) IsStderrTTY() bool
- func (s *IOStreams) IsStdinTTY() bool
- func (s *IOStreams) IsStdoutTTY() bool
- func (s *IOStreams) ProgressIndicatorEnabled() bool
- func (s *IOStreams) SetColorEnabled(v bool)
- func (s *IOStreams) SetInteractive(v bool)
- func (s *IOStreams) SetProgressIndicatorEnabled(v bool)
- func (s *IOStreams) SetStderrTTY(isTTY bool)
- func (s *IOStreams) SetStdinTTY(isTTY bool)
- func (s *IOStreams) SetStdoutTTY(isTTY bool)
- func (s *IOStreams) StartProgressIndicator()
- func (s *IOStreams) StartProgressIndicatorWithLabel(label string)
- func (s *IOStreams) StopProgressIndicator()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvColorDisabled ¶
func EnvColorDisabled() bool
func EnvColorForced ¶
func EnvColorForced() bool
func IsTerminal ¶
IsTerminal returns true if the stream is a terminal.
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter wraps strings in ANSI escape sequences.
func NewFormatter ¶
func (*Formatter) ColorFromString ¶
func (*Formatter) FailureIcon ¶
func (*Formatter) SuccessIcon ¶
func (*Formatter) WarningIcon ¶
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 (*IOStreams) IsColorEnabled ¶
IsColorEnabled returns true if color output is enabled.
func (*IOStreams) IsInteractive ¶
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 ¶
IsStderrTTY returns true if [IOStreams.Err] is a TTY.
func (*IOStreams) IsStdinTTY ¶
IsStdinTTY returns true if [IOStreams.In] is a TTY.
func (*IOStreams) IsStdoutTTY ¶
IsStdoutTTY returns true if [IOStreams.Out] is a TTY.
func (*IOStreams) ProgressIndicatorEnabled ¶
ProgressIndicatorEnabled returns true if the progress indicator is enabled.
func (*IOStreams) SetColorEnabled ¶
SetColorEnabled sets whether color is enabled.
func (*IOStreams) SetInteractive ¶
SetInteractive explicitly sets whether this is an interactive session.
func (*IOStreams) SetProgressIndicatorEnabled ¶
SetProgressIndicatorEnabled sets whether the progress indicator is enabled.
func (*IOStreams) SetStderrTTY ¶
SetStderrTTY explicitly flags [IOStreams.Err] as a TTY.
func (*IOStreams) SetStdinTTY ¶
SetStdinTTY explicitly flags [IOStreams.In] as a TTY.
func (*IOStreams) SetStdoutTTY ¶
SetStdoutTTY explicitly flags [IOStreams.Out] as a TTY.
func (*IOStreams) StartProgressIndicator ¶
func (s *IOStreams) StartProgressIndicator()
func (*IOStreams) StartProgressIndicatorWithLabel ¶
func (*IOStreams) StopProgressIndicator ¶
func (s *IOStreams) StopProgressIndicator()