Source File
reader.go
Belonging Package
src.elv.sh/pkg/cli/term
package termimport ()// Reader reads events from the terminal.type Reader interface {// ReadEvent reads a single event from the terminal.ReadEvent() (Event, error)// ReadRawEvent reads a single raw event from the terminal. The concept of// raw events is applicable where terminal events are represented as escape// sequences sequences, such as most modern Unix terminal emulators. If// the concept is not applicable, such as in the Windows console, it is// equivalent to ReadEvent.ReadRawEvent() (Event, error)// Close releases resources associated with the Reader. Any outstanding// ReadEvent or ReadRawEvent call will be aborted, returning ErrStopped.Close()}// ErrStopped is returned by Reader when Close is called during a ReadEvent or// ReadRawEvent method.var ErrStopped = errors.New("stopped")var errTimeout = errors.New("timed out")type seqError struct {msg stringseq string}func ( seqError) () string {return fmt.Sprintf("%s: %q", .msg, .seq)}// NewReader creates a new Reader on the given terminal file.//// TODO: NewReader should return an error as well. Right now failure to// initialize Reader panics.func ( *os.File) Reader {return newReader()}// IsReadErrorRecoverable returns whether an error returned by Reader is// recoverable.func ( error) bool {if , := .(seqError); {return true}return == ErrStopped || == errTimeout}
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)