Documentation ¶
Index ¶
- Variables
- func Is256ColorSupported() bool
- func IsCygwinTerminal(f *os.File) bool
- func NewColorable(out io.Writer) io.Writer
- func TerminalWidth(out io.Writer) int
- type ColorPalette
- type IOStreams
- func (s *IOStreams) BackgroundColor() string
- func (s *IOStreams) Color() *ColorPalette
- func (s *IOStreams) ColorEnabled() bool
- func (s *IOStreams) Is256ColorSupported() bool
- func (s *IOStreams) IsOutputTTY() bool
- func (s *IOStreams) Log(msg ...interface{})
- func (s *IOStreams) LogInfo(a ...interface{})
- func (s *IOStreams) LogInfof(format string, a ...interface{})
- func (s *IOStreams) Logf(format string, a ...interface{})
- func (s *IOStreams) PromptEnabled() bool
- func (s *IOStreams) ResolveBackgroundColor(style string) string
- func (s *IOStreams) SetPager(cmd string)
- func (s *IOStreams) SetPrompt(promptDisabled string)
- func (s *IOStreams) StartPager() error
- func (s *IOStreams) StartSpinner(format string, a ...interface{})
- func (s *IOStreams) StopPager()
- func (s *IOStreams) StopSpinner(format string, a ...interface{})
- func (s *IOStreams) TerminalWidth() int
Constants ¶
This section is empty.
Variables ¶
View Source
var IsTerminal = func(f *os.File) bool { return isatty.IsTerminal(f.Fd()) || IsCygwinTerminal(f) }
IsTerminal reports whether the file descriptor is connected to a terminal
Functions ¶
func Is256ColorSupported ¶ added in v1.16.0
func Is256ColorSupported() bool
func IsCygwinTerminal ¶
func NewColorable ¶
NewColorable returns an output stream that handles ANSI color sequences on Windows
func TerminalWidth ¶
Types ¶
type ColorPalette ¶
type ColorPalette struct { // Magenta outputs ANSI color if stdout is a tty Magenta func(string) string // Cyan outputs ANSI color if stdout is a tty Cyan func(string) string // Red outputs ANSI color if stdout is a tty Red func(string) string // Yellow outputs ANSI color if stdout is a tty Yellow func(string) string // Blue outputs ANSI color if stdout is a tty Blue func(string) string // Green outputs ANSI color if stdout is a tty Green func(string) string // Gray outputs ANSI color if stdout is a tty Gray func(string) string // Bold outputs ANSI color if stdout is a tty Bold func(string) string }
func (*ColorPalette) DotWarnIcon ¶ added in v1.18.0
func (c *ColorPalette) DotWarnIcon() string
func (*ColorPalette) FailedIcon ¶
func (c *ColorPalette) FailedIcon() string
func (*ColorPalette) GreenCheck ¶
func (c *ColorPalette) GreenCheck() string
func (*ColorPalette) ProgressIcon ¶ added in v1.18.0
func (c *ColorPalette) ProgressIcon() string
func (*ColorPalette) RedCheck ¶
func (c *ColorPalette) RedCheck() string
func (*ColorPalette) WarnIcon ¶
func (c *ColorPalette) WarnIcon() string
type IOStreams ¶
type IOStreams struct { In io.ReadCloser StdOut io.Writer StdErr io.Writer IsaTTY bool //stdout is a tty IsErrTTY bool //stderr is a tty IsInTTY bool //stdin is a tty // contains filtered or unexported fields }
func (*IOStreams) BackgroundColor ¶ added in v1.16.0
func (*IOStreams) Color ¶
func (s *IOStreams) Color() *ColorPalette
func (*IOStreams) ColorEnabled ¶
func (*IOStreams) Is256ColorSupported ¶ added in v1.16.0
func (*IOStreams) IsOutputTTY ¶
IsOutputTTY returns true if both stdout and stderr is TTY
func (*IOStreams) Log ¶ added in v1.18.0
func (s *IOStreams) Log(msg ...interface{})
Log prints output to StdErr
func (*IOStreams) LogInfo ¶ added in v1.18.0
func (s *IOStreams) LogInfo(a ...interface{})
LogInfo is just like Log but prints output to StdOut
func (*IOStreams) LogInfof ¶ added in v1.18.0
LogInfof formats according to a format specifier and writes to StdOut
func (*IOStreams) Logf ¶ added in v1.18.0
Logf formats according to a format specifier and writes to StdErr
func (*IOStreams) PromptEnabled ¶
func (*IOStreams) ResolveBackgroundColor ¶ added in v1.16.0
func (*IOStreams) StartPager ¶
func (*IOStreams) StartSpinner ¶
func (*IOStreams) StopSpinner ¶
func (*IOStreams) TerminalWidth ¶
Click to show internal directories.
Click to hide internal directories.