Documentation ¶
Index ¶
- func BackgroundColor(in, out *os.File) (c color.Color)
- func CursorColor(in, out *os.File) (c color.Color)
- func ForegroundColor(in, out *os.File) (c color.Color)
- func GetSize(fd uintptr) (width, height int, err error)
- func IsTerminal(fd uintptr) bool
- func QueryTerminal(in *os.File, out *os.File, filter QueryTerminalFilter, query string) error
- func ReadPassword(fd uintptr) ([]byte, error)
- func Restore(fd uintptr, oldState *State) error
- func SetState(fd uintptr, state *State) error
- func SupportsKittyKeyboard(in, out *os.File) (supported bool)
- type Environ
- type OsEnviron
- type QueryTerminalFilter
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundColor ¶
BackgroundColor queries the terminal for the background color. If the terminal does not support querying the background color, nil is returned.
func CursorColor ¶
CursorColor queries the terminal for the cursor color. If the terminal does not support querying the cursor color, nil is returned.
func ForegroundColor ¶
ForegroundColor queries the terminal for the foreground color. If the terminal does not support querying the foreground color, nil is returned.
func GetSize ¶
GetSize returns the visible dimensions of the given terminal.
These dimensions don't include any scrollback buffer height.
func IsTerminal ¶
IsTerminal returns whether the given file descriptor is a terminal.
func QueryTerminal ¶
QueryTerminal queries the terminal for support of various features and returns a list of response events. Most of the time, you will need to set stdin to raw mode before calling this function. Note: This function will block until the terminal responds or the timeout is reached.
func ReadPassword ¶
ReadPassword reads a line of input from a terminal without local echo. This is commonly used for inputting passwords and other sensitive data. The slice returned does not include the \n.
func Restore ¶
Restore restores the terminal connected to the given file descriptor to a previous state.
func SupportsKittyKeyboard ¶
SupportsKittyKeyboard returns true if the terminal supports the Kitty keyboard protocol.
Types ¶
type Environ ¶
type Environ interface { Getenv(string) string LookupEnv(string) (string, bool) Environ() []string }
Environ represents the terminal environment.
type OsEnviron ¶
type OsEnviron struct{}
OsEnviron is an implementation of Environ that uses os.Environ.
type QueryTerminalFilter ¶
QueryTerminalFilter is a function that filters input events using a type switch. If false is returned, the QueryTerminal function will stop reading input.