Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶
IsTerminal returns whether the passed io.Reader is a terminal or not
Types ¶
type TTY ¶
type TTY struct { // In is a reader to check for a terminal. In io.Reader // Raw is true if the terminal should be set raw. Raw bool // TryDev indicates the TTY should try to open /dev/tty if the provided input // is not a file descriptor. TryDev bool // Parent is an optional interrupt handler provided to this function - if provided // it will be invoked after the terminal state is restored. If it is not provided, // a signal received during the TTY will result in os.Exit(0) being invoked. Parent *interrupt.Handler }
TTY helps invoke a function and preserve the state of the terminal, even if the process is terminated during execution.
func (TTY) IsTerminal ¶
IsTerminal returns true if the provided input is a terminal. Does not check /dev/tty even if TryDev is set.
Click to show internal directories.
Click to hide internal directories.