Documentation
¶
Index ¶
- func GetStdinSize() (width, height int, err error)
- func GetTerminalSize(fd int) (width, height int, err error)
- func IsColorDisabled() bool
- func IsColorForced() bool
- func IsStdinTerminal() bool
- func IsStdoutTerminal() bool
- func IsTerminal(f *os.File) bool
- func IsTerminalFd(fd int) bool
- type RawMode
- type Term
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStdinSize ¶
GetStdinSize returns the size of the stdin terminal
func GetTerminalSize ¶
GetTerminalSize returns the terminal size for the given file descriptor. This is the canonical wrapper for x/term.GetSize — use this instead of importing golang.org/x/term directly.
func IsColorDisabled ¶ added in v0.3.2
func IsColorDisabled() bool
IsColorDisabled returns true if environment variables NO_COLOR or CLICOLOR prohibit usage of color codes in terminal output.
func IsColorForced ¶ added in v0.3.2
func IsColorForced() bool
IsColorForced returns true if environment variable CLICOLOR_FORCE is set to force colored terminal output.
func IsStdoutTerminal ¶
func IsStdoutTerminal() bool
IsStdoutTerminal checks if stdout is a terminal
func IsTerminal ¶ added in v0.3.2
IsTerminal reports whether a file descriptor is connected to a terminal.
func IsTerminalFd ¶
IsTerminalFd checks if a file descriptor is a terminal
Types ¶
type RawMode ¶
type RawMode struct {
// contains filtered or unexported fields
}
RawMode manages putting the terminal into raw mode
func NewRawMode ¶
NewRawMode creates a new RawMode manager for the given file descriptor
func NewRawModeStdin ¶
func NewRawModeStdin() *RawMode
NewRawModeStdin creates a RawMode manager for stdin
func (*RawMode) IsTerminal ¶
IsTerminal checks if the file descriptor is a terminal
type Term ¶
type Term struct {
// contains filtered or unexported fields
}
Term holds detected terminal capabilities and file descriptors.
func FromEnv ¶
func FromEnv() Term
FromEnv creates a Term by reading from the real system environment.
func (*Term) Is256ColorSupported ¶
Is256ColorSupported returns true if the terminal supports 256 colors.
func (*Term) IsColorEnabled ¶
IsColorEnabled returns true if basic color output is supported.
func (*Term) IsTrueColorSupported ¶
IsTrueColorSupported returns true if the terminal supports 24-bit true color.