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) Hyperlink(displayText, targetURL string) string
- 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) SetDisplayHyperlinks(displayHyperlinks 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 ¶
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 ¶
func (c *ColorPalette) DotWarnIcon() string
func (*ColorPalette) FailedIcon ¶
func (c *ColorPalette) FailedIcon() string
func (*ColorPalette) GreenCheck ¶
func (c *ColorPalette) GreenCheck() string
func (*ColorPalette) ProgressIcon ¶
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 ¶
func (*IOStreams) Color ¶
func (s *IOStreams) Color() *ColorPalette
func (*IOStreams) ColorEnabled ¶
func (*IOStreams) Is256ColorSupported ¶
func (*IOStreams) IsOutputTTY ¶
IsOutputTTY returns true if both stdout and stderr is TTY
func (*IOStreams) LogInfo ¶
func (s *IOStreams) LogInfo(a ...interface{})
LogInfo is just like Log but prints output to StdOut
func (*IOStreams) PromptEnabled ¶
func (*IOStreams) ResolveBackgroundColor ¶
func (*IOStreams) SetDisplayHyperlinks ¶
func (*IOStreams) StartPager ¶
func (*IOStreams) StartSpinner ¶
func (*IOStreams) StopSpinner ¶
func (*IOStreams) TerminalWidth ¶
Click to show internal directories.
Click to hide internal directories.