node

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTerminalType = "xterm-256color"

	DefaultTermWidth  = 60
	DefaultTermHeight = 120

	EnvVarTermType = "TERM"
)

Variables

This section is empty.

Functions

func GetConsoleSize

func GetConsoleSize(ctx context.Context, attach api.AttachIO) *[2]uint

GetConsoleSize returns the console size for terminal attachment.

func GetTerminalType

func GetTerminalType() string

GetTerminalType retrieves the terminal type from the environment variables.

func HandleTerminalResizing

func HandleTerminalResizing(ctx context.Context, attach api.AttachIO, resizeFunc func(api.TermSize) error)

HandleTerminalResizing listens for terminal resize events and adjusts accordingly using the provided resizeFunc.

Types

type ExecIO

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

ExecIO implements the api.AttachIO interface and holds the I/O streams and resize channel.

func DiscardingExecIO

func DiscardingExecIO() *ExecIO

DiscardingExecIO creates a new ExecIO with stdout set to discard all data. nolint: ireturn

func NewExecIO

func NewExecIO(tty bool, stdin io.Reader, stdout, stderr io.WriteCloser, chResize chan api.TermSize) *ExecIO

NewExecIO creates a new ExecIO with the given I/O streams and resize channel.

func (*ExecIO) Resize

func (e *ExecIO) Resize() <-chan api.TermSize

Resize returns the resize channel.

func (*ExecIO) Stderr

func (e *ExecIO) Stderr() io.WriteCloser

Stderr returns the stderr writer.

func (*ExecIO) Stdin

func (e *ExecIO) Stdin() io.Reader

Stdin returns the stdin reader.

func (*ExecIO) Stdout

func (e *ExecIO) Stdout() io.WriteCloser

Stdout returns the stdout writer.

func (*ExecIO) TTY

func (e *ExecIO) TTY() bool

TTY returns whether the terminal is a TTY.

Jump to

Keyboard shortcuts

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