Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Listen ¶
Listen reads single bytes from stdin and sends KeyEvents for recognized keys. It returns when done is closed, ctrl+c/ctrl+d is received, or stdin reaches EOF.
Note: the internal readLoop goroutine may outlive Listen because os.Stdin.Read is a blocking syscall with no cancellation mechanism. This is acceptable for a CLI tool where process exit reclaims all resources.
Types ¶
type KeyEvent ¶
type KeyEvent struct {
Key string // non-empty if a recognized key was pressed
EOF bool // true on ctrl+d (stdin closed)
}
KeyEvent represents a keyboard input event.
type RawMode ¶
type RawMode struct {
// contains filtered or unexported fields
}
RawMode manages terminal raw mode state.
func NewRawMode ¶
NewRawMode creates a RawMode for the given file descriptor.
Click to show internal directories.
Click to hide internal directories.