Documentation
¶
Index ¶
- Constants
- type ColorScheme
- func (c *ColorScheme) Blue(t string) string
- func (c *ColorScheme) Bluef(t string, args ...interface{}) string
- func (c *ColorScheme) Bold(t string) string
- func (c *ColorScheme) Boldf(t string, args ...interface{}) string
- func (c *ColorScheme) ColorFromString(s string) func(string) string
- func (c *ColorScheme) Cyan(t string) string
- func (c *ColorScheme) CyanBold(t string) string
- func (c *ColorScheme) Cyanf(t string, args ...interface{}) string
- func (c *ColorScheme) FailureIcon() string
- func (c *ColorScheme) FailureIconWithColor(colo func(string) string) string
- func (c *ColorScheme) Gray(t string) stringdeprecated
- func (c *ColorScheme) Grayf(t string, args ...interface{}) stringdeprecated
- func (c *ColorScheme) Green(t string) string
- func (c *ColorScheme) GreenBold(t string) string
- func (c *ColorScheme) Greenf(t string, args ...interface{}) string
- func (c *ColorScheme) Highlight(t string) string
- func (c *ColorScheme) HighlightStart() string
- func (c *ColorScheme) Label(hex string, x string) string
- func (c *ColorScheme) Magenta(t string) string
- func (c *ColorScheme) Magentaf(t string, args ...interface{}) string
- func (c *ColorScheme) Muted(t string) string
- func (c *ColorScheme) Mutedf(t string, args ...interface{}) string
- func (c *ColorScheme) Red(t string) string
- func (c *ColorScheme) Redf(t string, args ...interface{}) string
- func (c *ColorScheme) Reset() string
- func (c *ColorScheme) SuccessIcon() string
- func (c *ColorScheme) SuccessIconWithColor(colo func(string) string) string
- func (c *ColorScheme) TableHeader(t string) string
- func (c *ColorScheme) WarningIcon() string
- func (c *ColorScheme) Yellow(t string) string
- func (c *ColorScheme) Yellowf(t string, args ...interface{}) string
- type ErrClosedPagerPipe
- type IOStreams
- func (s *IOStreams) AccessibleColorsEnabled() bool
- func (s *IOStreams) AccessiblePrompterEnabled() bool
- func (s *IOStreams) CanPrompt() bool
- func (s *IOStreams) ColorEnabled() bool
- func (s *IOStreams) ColorLabels() bool
- func (s *IOStreams) ColorScheme() *ColorScheme
- func (s *IOStreams) ColorSupport256() bool
- func (s *IOStreams) DetectTerminalTheme()
- func (s *IOStreams) GetNeverPrompt() bool
- func (s *IOStreams) GetPager() string
- func (s *IOStreams) GetSpinnerDisabled() bool
- func (s *IOStreams) HasTrueColor() bool
- func (s *IOStreams) IsStderrTTY() bool
- func (s *IOStreams) IsStdinTTY() bool
- func (s *IOStreams) IsStdoutTTY() bool
- func (s *IOStreams) ReadUserFile(fn string) ([]byte, error)
- func (s *IOStreams) RefreshScreen()
- func (s *IOStreams) RunWithProgress(label string, run func() error) error
- func (s *IOStreams) SetAccessibleColorsEnabled(enabled bool)
- func (s *IOStreams) SetAccessiblePrompterEnabled(enabled bool)
- func (s *IOStreams) SetAlternateScreenBufferEnabled(enabled bool)
- func (s *IOStreams) SetColorEnabled(colorEnabled bool)
- func (s *IOStreams) SetColorLabels(colorLabels bool)
- func (s *IOStreams) SetNeverPrompt(v bool)
- func (s *IOStreams) SetPager(cmd string)
- func (s *IOStreams) SetSpinnerDisabled(v bool)
- func (s *IOStreams) SetStderrTTY(isTTY bool)
- func (s *IOStreams) SetStdinTTY(isTTY bool)
- func (s *IOStreams) SetStdoutTTY(isTTY bool)
- func (s *IOStreams) StartAlternateScreenBuffer()
- func (s *IOStreams) StartPager() error
- func (s *IOStreams) StartProgressIndicator()
- func (s *IOStreams) StartProgressIndicatorWithLabel(label string)
- func (s *IOStreams) StopAlternateScreenBuffer()
- func (s *IOStreams) StopPager()
- func (s *IOStreams) StopProgressIndicator()
- func (s *IOStreams) TempFile(dir, pattern string) (*os.File, error)
- func (s *IOStreams) TerminalTheme() string
- func (s *IOStreams) TerminalWidth() int
Constants ¶
const ( NoTheme = "none" DarkTheme = "dark" LightTheme = "light" )
const DefaultWidth = 80
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorScheme ¶
type ColorScheme struct {
// Enabled is whether color is used at all.
Enabled bool
// EightBitColor is whether the terminal supports 8-bit, 256 colors.
EightBitColor bool
// TrueColor is whether the terminal supports 24-bit, 16 million colors.
TrueColor bool
// Accessible is whether colors must be base 16 colors that users can customize in terminal preferences.
Accessible bool
// ColorLabels is whether labels are colored based on their truecolor RGB hex color.
ColorLabels bool
// Theme is the terminal background color theme used to contextually color text for light, dark, or none at all.
Theme string
}
ColorScheme controls how text is colored based upon terminal capabilities and user preferences.
func (*ColorScheme) Blue ¶
func (c *ColorScheme) Blue(t string) string
func (*ColorScheme) Bluef ¶
func (c *ColorScheme) Bluef(t string, args ...interface{}) string
func (*ColorScheme) Bold ¶
func (c *ColorScheme) Bold(t string) string
func (*ColorScheme) Boldf ¶
func (c *ColorScheme) Boldf(t string, args ...interface{}) string
func (*ColorScheme) ColorFromString ¶
func (c *ColorScheme) ColorFromString(s string) func(string) string
func (*ColorScheme) Cyan ¶
func (c *ColorScheme) Cyan(t string) string
func (*ColorScheme) CyanBold ¶
func (c *ColorScheme) CyanBold(t string) string
func (*ColorScheme) Cyanf ¶
func (c *ColorScheme) Cyanf(t string, args ...interface{}) string
func (*ColorScheme) FailureIcon ¶
func (c *ColorScheme) FailureIcon() string
func (*ColorScheme) FailureIconWithColor ¶
func (c *ColorScheme) FailureIconWithColor(colo func(string) string) string
func (*ColorScheme) Gray
deprecated
func (c *ColorScheme) Gray(t string) string
Deprecated: Use Muted instead for thematically contrasting color.
func (*ColorScheme) Grayf
deprecated
func (c *ColorScheme) Grayf(t string, args ...interface{}) string
Deprecated: Use Mutedf instead for thematically contrasting color.
func (*ColorScheme) Green ¶
func (c *ColorScheme) Green(t string) string
func (*ColorScheme) GreenBold ¶
func (c *ColorScheme) GreenBold(t string) string
func (*ColorScheme) Greenf ¶
func (c *ColorScheme) Greenf(t string, args ...interface{}) string
func (*ColorScheme) Highlight ¶
func (c *ColorScheme) Highlight(t string) string
func (*ColorScheme) HighlightStart ¶
func (c *ColorScheme) HighlightStart() string
func (*ColorScheme) Label ¶
func (c *ColorScheme) Label(hex string, x string) string
Label stylizes text based on label's RGB hex color.
func (*ColorScheme) Magenta ¶
func (c *ColorScheme) Magenta(t string) string
func (*ColorScheme) Magentaf ¶
func (c *ColorScheme) Magentaf(t string, args ...interface{}) string
func (*ColorScheme) Muted ¶
func (c *ColorScheme) Muted(t string) string
func (*ColorScheme) Mutedf ¶
func (c *ColorScheme) Mutedf(t string, args ...interface{}) string
func (*ColorScheme) Red ¶
func (c *ColorScheme) Red(t string) string
func (*ColorScheme) Redf ¶
func (c *ColorScheme) Redf(t string, args ...interface{}) string
func (*ColorScheme) Reset ¶
func (c *ColorScheme) Reset() string
func (*ColorScheme) SuccessIcon ¶
func (c *ColorScheme) SuccessIcon() string
func (*ColorScheme) SuccessIconWithColor ¶
func (c *ColorScheme) SuccessIconWithColor(colo func(string) string) string
func (*ColorScheme) TableHeader ¶
func (c *ColorScheme) TableHeader(t string) string
func (*ColorScheme) WarningIcon ¶
func (c *ColorScheme) WarningIcon() string
func (*ColorScheme) Yellow ¶
func (c *ColorScheme) Yellow(t string) string
func (*ColorScheme) Yellowf ¶
func (c *ColorScheme) Yellowf(t string, args ...interface{}) string
type ErrClosedPagerPipe ¶
type ErrClosedPagerPipe struct {
// contains filtered or unexported fields
}
ErrClosedPagerPipe is the error returned when writing to a pager that has been closed.
type IOStreams ¶
type IOStreams struct {
In fileReader
Out fileWriter
ErrOut fileWriter
TempFileOverride *os.File
// contains filtered or unexported fields
}
func (*IOStreams) AccessibleColorsEnabled ¶
func (*IOStreams) AccessiblePrompterEnabled ¶
func (*IOStreams) ColorEnabled ¶
func (*IOStreams) ColorLabels ¶
func (*IOStreams) ColorScheme ¶
func (s *IOStreams) ColorScheme() *ColorScheme
func (*IOStreams) ColorSupport256 ¶
func (*IOStreams) DetectTerminalTheme ¶
func (s *IOStreams) DetectTerminalTheme()
DetectTerminalTheme is a utility to call before starting the output pager so that the terminal background can be reliably detected.
func (*IOStreams) GetNeverPrompt ¶
func (*IOStreams) GetSpinnerDisabled ¶
func (*IOStreams) HasTrueColor ¶
func (*IOStreams) IsStderrTTY ¶
func (*IOStreams) IsStdinTTY ¶
func (*IOStreams) IsStdoutTTY ¶
func (*IOStreams) RefreshScreen ¶
func (s *IOStreams) RefreshScreen()
func (*IOStreams) RunWithProgress ¶
func (*IOStreams) SetAccessibleColorsEnabled ¶
func (*IOStreams) SetAccessiblePrompterEnabled ¶
func (*IOStreams) SetAlternateScreenBufferEnabled ¶
func (*IOStreams) SetColorEnabled ¶
func (*IOStreams) SetColorLabels ¶
func (*IOStreams) SetNeverPrompt ¶
func (*IOStreams) SetSpinnerDisabled ¶
func (*IOStreams) SetStderrTTY ¶
func (*IOStreams) SetStdinTTY ¶
func (*IOStreams) SetStdoutTTY ¶
func (*IOStreams) StartAlternateScreenBuffer ¶
func (s *IOStreams) StartAlternateScreenBuffer()
func (*IOStreams) StartPager ¶
func (*IOStreams) StartProgressIndicator ¶
func (s *IOStreams) StartProgressIndicator()
func (*IOStreams) StartProgressIndicatorWithLabel ¶
func (*IOStreams) StopAlternateScreenBuffer ¶
func (s *IOStreams) StopAlternateScreenBuffer()
func (*IOStreams) StopProgressIndicator ¶
func (s *IOStreams) StopProgressIndicator()
StopProgressIndicator stops the progress indicator if it is running. Note that a textual progess indicator does not create a progress indicator, so this method is a no-op in that case.
func (*IOStreams) TerminalTheme ¶
TerminalTheme returns "light", "dark", or "none" depending on the background color of the terminal.
func (*IOStreams) TerminalWidth ¶
TerminalWidth returns the width of the terminal that controls the process