iostreams

package
v1.6.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultWidth = 80

Variables

This section is empty.

Functions

func EnvColorDisabled

func EnvColorDisabled() bool

func EnvColorForced

func EnvColorForced() bool

func HasAlternateScreenBuffer added in v1.3.0

func HasAlternateScreenBuffer(hasTrueColor bool) bool

func Is256ColorSupported

func Is256ColorSupported() bool

func IsTrueColorSupported

func IsTrueColorSupported() bool

Types

type ColorScheme

type ColorScheme struct {
	// contains filtered or unexported fields
}

func NewColorScheme

func NewColorScheme(enabled, is256enabled bool, trueColor bool) *ColorScheme

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

func (c *ColorScheme) Gray(t string) string

func (*ColorScheme) Grayf

func (c *ColorScheme) Grayf(t string, args ...interface{}) string

func (*ColorScheme) Green

func (c *ColorScheme) Green(t string) string

func (*ColorScheme) Greenf

func (c *ColorScheme) Greenf(t string, args ...interface{}) string

func (*ColorScheme) HexToRGB

func (c *ColorScheme) HexToRGB(hex string, x string) string

func (*ColorScheme) Magenta

func (c *ColorScheme) Magenta(t string) string

func (*ColorScheme) Magentaf

func (c *ColorScheme) Magentaf(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) SuccessIcon

func (c *ColorScheme) SuccessIcon() string

func (*ColorScheme) SuccessIconWithColor

func (c *ColorScheme) SuccessIconWithColor(colo func(string) 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 IOStreams

type IOStreams struct {
	In     io.ReadCloser
	Out    io.Writer
	ErrOut io.Writer

	TempFileOverride *os.File
	// contains filtered or unexported fields
}

func System

func System() *IOStreams

func Test

func Test() (*IOStreams, *bytes.Buffer, *bytes.Buffer, *bytes.Buffer)

func (*IOStreams) CanPrompt

func (s *IOStreams) CanPrompt() bool

func (*IOStreams) ColorEnabled

func (s *IOStreams) ColorEnabled() bool

func (*IOStreams) ColorScheme

func (s *IOStreams) ColorScheme() *ColorScheme

func (*IOStreams) ColorSupport256

func (s *IOStreams) ColorSupport256() bool

func (*IOStreams) DetectTerminalTheme

func (s *IOStreams) DetectTerminalTheme() string

func (*IOStreams) EnableVirtualTerminalProcessing

func (s *IOStreams) EnableVirtualTerminalProcessing() error

func (*IOStreams) ForceTerminal

func (s *IOStreams) ForceTerminal(spec string)

ForceTerminal will force the CLI to output to a terminal.

func (*IOStreams) GetNeverPrompt

func (s *IOStreams) GetNeverPrompt() bool

func (*IOStreams) GetPager

func (s *IOStreams) GetPager() string

func (*IOStreams) HasTrueColor

func (s *IOStreams) HasTrueColor() bool

func (*IOStreams) IsStderrTTY

func (s *IOStreams) IsStderrTTY() bool

func (*IOStreams) IsStdinTTY

func (s *IOStreams) IsStdinTTY() bool

func (*IOStreams) IsStdoutTTY

func (s *IOStreams) IsStdoutTTY() bool

func (*IOStreams) ProcessTerminalWidth

func (s *IOStreams) ProcessTerminalWidth() int

ProcessTerminalWidth returns the width of the terminal that the process is attached to.

func (*IOStreams) ReadUserFile

func (s *IOStreams) ReadUserFile(fn string) ([]byte, error)

func (*IOStreams) SetColorEnabled

func (s *IOStreams) SetColorEnabled(colorEnabled bool)

func (*IOStreams) SetNeverPrompt

func (s *IOStreams) SetNeverPrompt(v bool)

func (*IOStreams) SetPager

func (s *IOStreams) SetPager(cmd string)

func (*IOStreams) SetStderrTTY

func (s *IOStreams) SetStderrTTY(isTTY bool)

func (*IOStreams) SetStdinTTY

func (s *IOStreams) SetStdinTTY(isTTY bool)

func (*IOStreams) SetStdoutTTY

func (s *IOStreams) SetStdoutTTY(isTTY bool)

func (*IOStreams) StartPager

func (s *IOStreams) StartPager() error

func (*IOStreams) StartProgressIndicator

func (s *IOStreams) StartProgressIndicator()

func (*IOStreams) StartProgressIndicatorWithLabel

func (s *IOStreams) StartProgressIndicatorWithLabel(label string)

func (*IOStreams) StopPager

func (s *IOStreams) StopPager()

func (*IOStreams) StopProgressIndicator

func (s *IOStreams) StopProgressIndicator()

func (*IOStreams) TempFile

func (s *IOStreams) TempFile(dir, pattern string) (*os.File, error)

func (*IOStreams) TerminalTheme

func (s *IOStreams) TerminalTheme() string

func (*IOStreams) TerminalWidth

func (s *IOStreams) TerminalWidth() int

TerminalWidth returns the width of the terminal that stdout is attached to. TODO: investigate whether ProcessTerminalWidth could replace all this.

func (*IOStreams) UpdateProgressIndicatorLabel

func (s *IOStreams) UpdateProgressIndicatorLabel(label string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL