 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func IsCygwinTerminal(f *os.File) bool
- func NewColorable(out io.Writer) io.Writer
- func PagerCommandFromEnv() string
- 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) IsInputTTY() bool
- func (s *IOStreams) IsOutputTTY() bool
- func (s *IOStreams) Log(msg ...any)
- func (s *IOStreams) LogInfo(a ...any)
- func (s *IOStreams) LogInfof(format string, a ...any)
- func (s *IOStreams) Logf(format string, a ...any)
- 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 ...any)
- func (s *IOStreams) StopPager()
- func (s *IOStreams) StopSpinner(format string, a ...any)
- func (s *IOStreams) TerminalWidth() int
 
- type IOStreamsOption
- func WithDisplayHyperLinks(displayHyperlinks string) IOStreamsOption
- func WithPagerCommand(command string) IOStreamsOption
- func WithStderr(stderr io.Writer, isTTY bool) IOStreamsOption
- func WithStdin(stdin io.ReadCloser, isTTY bool) IOStreamsOption
- func WithStdout(stdout io.Writer, isTTY bool) IOStreamsOption
 
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 IsCygwinTerminal ¶
func NewColorable ¶
NewColorable returns an output stream that handles ANSI color sequences on Windows
func PagerCommandFromEnv ¶
func PagerCommandFromEnv() string
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 New ¶
func New(options ...IOStreamsOption) *IOStreams
func (*IOStreams) BackgroundColor ¶
func (*IOStreams) Color ¶
func (s *IOStreams) Color() *ColorPalette
func (*IOStreams) ColorEnabled ¶
func (*IOStreams) Is256ColorSupported ¶
func (*IOStreams) IsInputTTY ¶
func (*IOStreams) IsOutputTTY ¶
IsOutputTTY returns true if both stdout and stderr is TTY
func (*IOStreams) PromptEnabled ¶
func (*IOStreams) ResolveBackgroundColor ¶
func (*IOStreams) SetDisplayHyperlinks ¶
func (*IOStreams) StartPager ¶
func (*IOStreams) StartSpinner ¶
func (*IOStreams) StopSpinner ¶
func (*IOStreams) TerminalWidth ¶
type IOStreamsOption ¶
type IOStreamsOption func(*IOStreams)
IOStreamsOption represents a function that configures io streams
func WithDisplayHyperLinks ¶
func WithDisplayHyperLinks(displayHyperlinks string) IOStreamsOption
func WithPagerCommand ¶
func WithPagerCommand(command string) IOStreamsOption
func WithStderr ¶
func WithStderr(stderr io.Writer, isTTY bool) IOStreamsOption
func WithStdin ¶
func WithStdin(stdin io.ReadCloser, isTTY bool) IOStreamsOption
func WithStdout ¶
func WithStdout(stdout io.Writer, isTTY bool) IOStreamsOption
 Click to show internal directories. 
   Click to hide internal directories.