xpty

package
v0.0.0-...-0996ee0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMockTerminalOpen    = errors.New("xpty: mock terminal open")
	ErrMockTerminalNotOpen = errors.New("xpty: mock terminal not open")
	ErrMockSessionOpen     = errors.New("xpty: mock session open")
	ErrMockSessionNotOpen  = errors.New("xpty: mock session not open")
)
View Source
var ErrUnsupported = errors.New("platform not supported by xpty")

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Path string
	Args []string
}

type MockComputer

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

func (*MockComputer) Read

func (c *MockComputer) Read(p []byte) (int, error)

func (*MockComputer) Write

func (c *MockComputer) Write(p []byte) (int, error)

type MockSession

type MockSession struct {
	T *MockTerminal
}

func (*MockSession) Close

func (s *MockSession) Close() error

func (*MockSession) GetSize

func (s *MockSession) GetSize() (Size, error)

func (*MockSession) SetSize

func (s *MockSession) SetSize(size Size) error

func (*MockSession) StartProcess

func (s *MockSession) StartProcess(cmd Cmd) (*os.Process, error)

type MockTerminal

type MockTerminal struct {
	ErrOpen          error
	ErrSession       error
	ErrStartProcess  error
	ErrGetSize       error
	ErrSetSize       error
	ErrCloseSession  error
	ErrCloseTerminal error
	PID              int

	Size         Size
	Cmd          Cmd
	OpenTerminal bool
	OpenSession  bool
	// contains filtered or unexported fields
}

func (*MockTerminal) Close

func (t *MockTerminal) Close() error

func (*MockTerminal) Computer

func (t *MockTerminal) Computer() *MockComputer

func (*MockTerminal) Open

func (t *MockTerminal) Open() (Terminal, error)

func (*MockTerminal) Read

func (t *MockTerminal) Read(p []byte) (int, error)

func (*MockTerminal) Session

func (t *MockTerminal) Session(size Size) (Session, error)

func (*MockTerminal) Write

func (t *MockTerminal) Write(p []byte) (int, error)

type Session

type Session interface {
	StartProcess(cmd Cmd) (*os.Process, error)
	GetSize() (Size, error)
	SetSize(Size) error
	Close() error
}

type Size

type Size struct {
	Row, Col int
}

type SizeError

type SizeError struct {
	Size Size
}

func (*SizeError) Error

func (e *SizeError) Error() string

type Terminal

type Terminal interface {
	io.ReadWriteCloser
	Session(Size) (Session, error)
}

func Open

func Open() (Terminal, error)

Jump to

Keyboard shortcuts

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