streams

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type In

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

func NewIn

func NewIn(in io.ReadCloser) *In

NewIn returns a new In from an io.ReadCloser.

func (*In) CheckTty

func (i *In) CheckTty(attachStdin, ttyMode bool) error

CheckTty checks if we are trying to attach to a container TTY from a non-TTY client input stream, and if so, returns an error.

func (*In) Close

func (i *In) Close() error

Close implements the io.Closer interface.

func (*In) FD

func (s *In) FD() uintptr

FD returns the file descriptor number for this stream.

func (*In) IsTerminal

func (s *In) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal.

func (*In) Read

func (i *In) Read(p []byte) (int, error)

Read implements the io.Reader interface.

func (*In) RestoreTerminal

func (s *In) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal.

func (*In) SetIsTerminal

func (s *In) SetIsTerminal(isTerminal bool)

SetIsTerminal overrides whether a terminal is connected. It is used to override this property in unit-tests, and should not be depended on for other purposes.

func (*In) SetRawTerminal

func (i *In) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal. It is a no-op if In is not a TTY, or if the "NORAW" environment variable is set to a non-empty value.

type Out

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

func NewOut

func NewOut(out io.Writer) *Out

NewOut returns a new Out from an io.Writer.

func (*Out) FD

func (s *Out) FD() uintptr

FD returns the file descriptor number for this stream.

func (*Out) GetTtySize

func (o *Out) GetTtySize() (height uint, width uint)

GetTtySize returns the height and width in characters of the TTY, or zero for both if no TTY is connected.

func (*Out) IsTerminal

func (s *Out) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal.

func (*Out) RestoreTerminal

func (s *Out) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal.

func (*Out) SetIsTerminal

func (s *Out) SetIsTerminal(isTerminal bool)

SetIsTerminal overrides whether a terminal is connected. It is used to override this property in unit-tests, and should not be depended on for other purposes.

func (*Out) SetRawTerminal

func (o *Out) SetRawTerminal() (err error)

SetRawTerminal puts the output of the terminal connected to the stream into raw mode.

On UNIX, this does nothing. On Windows, it disables LF -> CRLF/ translation. It is a no-op if Out is not a TTY, or if the "NORAW" environment variable is set to a non-empty value.

func (*Out) Write

func (o *Out) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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