internal

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidInput = iota
	ArrowUp
	ArrowDown
	ArrowLeft
	ArrowRight
	Enter
	Cancel

	ModeNone = iota - 1
	ModeSome
	Mode8Bit
	ModeFull
)

Variables

View Source
var ErrInterrupted = errors.New("interrupted")

Functions

func DetectColorLevel

func DetectColorLevel(_ int) int

func GetWriterFd

func GetWriterFd(writer io.Writer) (int, bool)

func ReadCtx

func ReadCtx[T any](ctx context.Context, t *Terminal, readFn func(*Terminal) (T, error)) (T, error)

func WaitForInterrupt

func WaitForInterrupt()

Types

type Result

type Result[T any] struct {
	Val T
	Err error
}

func NewResult

func NewResult[T any](val T, err error) Result[T]

type Terminal

type Terminal struct {
	// contains filtered or unexported fields
}

func OpenTTY

func OpenTTY(_ bool) (*Terminal, error)

func (*Terminal) Close

func (t *Terminal) Close()

func (*Terminal) HideCursor

func (t *Terminal) HideCursor()

func (*Terminal) ReadArrow

func (t *Terminal) ReadArrow() (int, error)

func (*Terminal) ReadKey

func (t *Terminal) ReadKey() (rune, error)

func (*Terminal) ReadLine

func (t *Terminal) ReadLine() ([]byte, error)

func (*Terminal) ReadMasked

func (t *Terminal) ReadMasked(out io.Writer, mask rune) ([]byte, error)

func (*Terminal) ReadVisible

func (t *Terminal) ReadVisible(out io.Writer, buf []byte, max int) ([]byte, error)

func (*Terminal) ShowCursor

func (t *Terminal) ShowCursor()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL