Documentation
¶
Index ¶
- Constants
- Variables
- func Ctermid() string
- func DebugPrintln(a ...any)
- func GetSize(fd int) (*unix.Winsize, error)
- func IsTerminal(fd uintptr) bool
- func Tcgetattr(fd int, argp *unix.Termios) error
- func Tcsetattr(fd int, action uintptr, argp *unix.Termios) error
- type Term
- func (self *Term) ApplyOperations(when uintptr, operations ...TermiosOperation) (err error)
- func (self *Term) Close() error
- func (self *Term) DebugPrintln(a ...any)
- func (self *Term) Fd() int
- func (self *Term) GetSize() (*unix.Winsize, error)
- func (self *Term) PopState() error
- func (self *Term) PopStateWhen(when uintptr) (err error)
- func (self *Term) Read(b []byte) (n int, err error)
- func (self *Term) ReadWithTimeout(b []byte, d time.Duration) (n int, err error)
- func (self *Term) Restore() error
- func (self *Term) RestoreAndClose() error
- func (self *Term) RestoreWhen(when uintptr) (err error)
- func (self *Term) Suspend() (resume func() error, err error)
- func (self *Term) SuspendAndRun(callback func() error) error
- func (self *Term) Tcgetattr(ans *unix.Termios) error
- func (self *Term) Tcsetattr(when uintptr, ans *unix.Termios) error
- func (self *Term) WasEchoOnOriginally() bool
- func (self *Term) Write(b []byte) (int, error)
- func (self *Term) WriteAll(b []byte) error
- func (self *Term) WriteAllString(s string) error
- func (self *Term) WriteString(b string) (int, error)
- type TermiosOperation
Constants ¶
View Source
const ( TCSANOW = 0 TCSADRAIN = 1 TCSAFLUSH = 2 )
View Source
const ( TCSETS = 0x5402 TCSETSW = 0x5403 TCSETSF = 0x5404 TCFLSH = 0x540B TCSBRK = 0x5409 TCSBRKP = 0x5425 IXON = 0x00000400 IXANY = 0x00000800 IXOFF = 0x00001000 CRTSCTS = 0x80000000 )
Variables ¶
Functions ¶
func DebugPrintln ¶
func DebugPrintln(a ...any)
func IsTerminal ¶
Types ¶
type Term ¶
type Term struct {
// contains filtered or unexported fields
}
func OpenControllingTerm ¶
func OpenControllingTerm(operations ...TermiosOperation) (self *Term, err error)
func WrapTerm ¶
func WrapTerm(fd int, name string, operations ...TermiosOperation) (self *Term, err error)
func (*Term) ApplyOperations ¶
func (self *Term) ApplyOperations(when uintptr, operations ...TermiosOperation) (err error)
func (*Term) DebugPrintln ¶
func (*Term) PopStateWhen ¶
func (*Term) ReadWithTimeout ¶
func (*Term) RestoreAndClose ¶
func (*Term) RestoreWhen ¶
func (*Term) SuspendAndRun ¶
func (*Term) WasEchoOnOriginally ¶
func (*Term) WriteAllString ¶
type TermiosOperation ¶
var SetBlockingRead TermiosOperation = SetReadTimeout(0)
var SetNoEcho TermiosOperation = func(t *unix.Termios) { t.Lflag &^= unix.ECHO }
var SetRaw TermiosOperation = func(t *unix.Termios) { t.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON t.Oflag &^= unix.OPOST t.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN t.Cflag &^= unix.CSIZE | unix.PARENB t.Cflag |= unix.CS8 t.Cc[unix.VMIN] = 1 t.Cc[unix.VTIME] = 0 }
func SetReadTimeout ¶
func SetReadTimeout(d time.Duration) TermiosOperation
Click to show internal directories.
Click to hide internal directories.