Documentation
¶
Overview ¶
Package iostreams provides input/output stream management
Index ¶
- func CanPromptForInput() bool
- func CaptureOutput(f func() error) (stdout, stderr string, err error)
- func IsInputTTY() bool
- type ColorScheme
- func (c *ColorScheme) Blue(text string) string
- func (c *ColorScheme) Bold(text string) string
- func (c *ColorScheme) ColorFromString(colorName string) func(string) string
- func (c *ColorScheme) Cyan(text string) string
- func (c *ColorScheme) FailureIcon() string
- func (c *ColorScheme) Gray(text string) string
- func (c *ColorScheme) Green(text string) string
- func (c *ColorScheme) Magenta(text string) string
- func (c *ColorScheme) Red(text string) string
- func (c *ColorScheme) SuccessIcon() string
- func (c *ColorScheme) WarningIcon() string
- func (c *ColorScheme) Yellow(text string) string
- type IOStreams
- func (s *IOStreams) CanPrompt() bool
- func (s *IOStreams) ColorEnabled() bool
- func (s *IOStreams) ColorScheme() *ColorScheme
- func (s *IOStreams) IsStderrTTY() bool
- func (s *IOStreams) IsStdinTTY() bool
- func (s *IOStreams) IsStdoutTTY() bool
- func (s *IOStreams) SetPager(pager string)
- func (s *IOStreams) StartPager() error
- func (s *IOStreams) StopPager() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanPromptForInput ¶
func CanPromptForInput() bool
CanPromptForInput returns true if we can prompt for input
func CaptureOutput ¶
CaptureOutput captures stdout and stderr for testing
Types ¶
type ColorScheme ¶
type ColorScheme struct {
// contains filtered or unexported fields
}
ColorScheme provides color output utilities
func (*ColorScheme) Blue ¶
func (c *ColorScheme) Blue(text string) string
Blue returns the text in blue
func (*ColorScheme) Bold ¶
func (c *ColorScheme) Bold(text string) string
Bold returns the text in bold
func (*ColorScheme) ColorFromString ¶
func (c *ColorScheme) ColorFromString(colorName string) func(string) string
ColorFromString returns a color function based on a string name
func (*ColorScheme) Cyan ¶
func (c *ColorScheme) Cyan(text string) string
Cyan returns the text in cyan
func (*ColorScheme) FailureIcon ¶
func (c *ColorScheme) FailureIcon() string
FailureIcon returns a red X
func (*ColorScheme) Gray ¶
func (c *ColorScheme) Gray(text string) string
Gray returns the text in gray
func (*ColorScheme) Green ¶
func (c *ColorScheme) Green(text string) string
Green returns the text in green
func (*ColorScheme) Magenta ¶
func (c *ColorScheme) Magenta(text string) string
Magenta returns the text in magenta
func (*ColorScheme) SuccessIcon ¶
func (c *ColorScheme) SuccessIcon() string
SuccessIcon returns a green checkmark
func (*ColorScheme) WarningIcon ¶
func (c *ColorScheme) WarningIcon() string
WarningIcon returns a yellow warning sign
func (*ColorScheme) Yellow ¶
func (c *ColorScheme) Yellow(text string) string
Yellow returns the text in yellow
type IOStreams ¶
type IOStreams struct {
In io.Reader
Out io.Writer
ErrOut io.Writer
// contains filtered or unexported fields
}
IOStreams holds the standard input, output, and error streams
func System ¶
func System() *IOStreams
System returns IOStreams connected to standard input, output, and error
func Test ¶
Test returns IOStreams suitable for testing
func (*IOStreams) CanPrompt ¶ added in v0.3.7
CanPromptForInput returns true when this IOStreams instance can prompt safely.
func (*IOStreams) ColorEnabled ¶
ColorEnabled returns true if color output is enabled
func (*IOStreams) ColorScheme ¶
func (s *IOStreams) ColorScheme() *ColorScheme
ColorScheme returns a ColorScheme for output
func (*IOStreams) IsStderrTTY ¶
IsStderrTTY returns true if stderr is a terminal
func (*IOStreams) IsStdinTTY ¶
IsStdinTTY returns true if stdin is a terminal
func (*IOStreams) IsStdoutTTY ¶
IsStdoutTTY returns true if stdout is a terminal
func (*IOStreams) SetPager ¶
SetPager sets the pager command
func (*IOStreams) StartPager ¶
StartPager starts a pager for output
Source Files
¶
- color.go
- iostreams.go