terminal

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTerminal

func IsTerminal(f FileDescriptor) bool

IsTerminal returns true if the given file descriptor is a terminal.

func OpenInput

func OpenInput() (*os.File, error)

OpenInput tries to get read and write access to the process' terminal.

func OpenOutput

func OpenOutput() (*os.File, error)

OpenOutput tries to get write access to the process' terminal.

func Restore

func Restore(f FileDescriptor, state *State) error

Restore restores the terminal connected to the given file descriptor to a previous state.

Types

type FileDescriptor

type FileDescriptor interface {
	Fd() uintptr
}

type Flag

type Flag uint32
const (
	LineFlag   Flag = unix.ICANON
	EchoFlag   Flag = unix.ECHO
	SignalFlag Flag = unix.ISIG
)

type State

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

State contains the state of a terminal.

func DisableFlags

func DisableFlags(f FileDescriptor, flags Flag) (*State, error)

DisableFlags disables the terminal flags specified in the function argument 'flags', and returns the previous state of the terminal so that it can be restored.

Jump to

Keyboard shortcuts

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