Documentation
¶
Index ¶
- type IOStreams
- func (s *IOStreams) ColorEnabled() bool
- func (s *IOStreams) ColorGreen(str string) string
- func (s *IOStreams) ColorMagenta(str string) string
- func (s *IOStreams) ColorRed(str string) string
- func (s *IOStreams) ColorYellow(str string) string
- func (s *IOStreams) SetColorEnabled(v bool)
- func (s *IOStreams) StartPager() error
- func (s *IOStreams) StopPager()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IOStreams ¶
type IOStreams struct {
In io.ReadCloser
Out io.Writer
ErrOut io.Writer
IsStdoutTTY func() bool
IsStderrTTY func() bool
// contains filtered or unexported fields
}
func (*IOStreams) ColorEnabled ¶
ColorEnabled reports whether color output should be emitted.
func (*IOStreams) ColorGreen ¶ added in v1.9.0
func (*IOStreams) ColorMagenta ¶ added in v1.9.0
func (*IOStreams) ColorYellow ¶ added in v1.17.0
ColorYellow renders in-progress / pending states. Distinct from green (terminal success) and red (terminal failure) so a glance at the table tells you whether a row is actively running, done, or broken.
func (*IOStreams) SetColorEnabled ¶ added in v1.17.0
SetColorEnabled overrides the color decision. The constructor seeds colorEnabled from TTY + NO_COLOR; SetColorEnabled lets a higher layer (e.g. a --no-color persistent flag in root) flip it off after construction. Pass true to force-enable color even on non-TTY (rarely useful — most callers only use this to force-disable).
func (*IOStreams) StartPager ¶
StartPager spawns $PAGER (default "less -FRX") and wires IOStreams.Out to the pager's stdin. Only activates when stdout is a TTY; no-op otherwise. Callers must defer StopPager() immediately after a successful call.