terminal

package
v0.12.21 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCols = 80
	DefaultRows = 24
)

Variables

View Source
var ErrUnsupported = errors.New("terminal sessions are not supported on this platform")

Functions

func DefaultShell

func DefaultShell() string

func Supported

func Supported() bool

Types

type Manager

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

func NewManager

func NewManager(dir string) *Manager

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Create

func (m *Manager) Create(shell string, cols, rows int) (*Session, error)

func (*Manager) Get

func (m *Manager) Get(id string) *Session

func (*Manager) List

func (m *Manager) List() []*Session

func (*Manager) Remove

func (m *Manager) Remove(id string) bool

func (*Manager) SetExitHandler

func (m *Manager) SetExitHandler(fn func(id string))

type Session

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

func (*Session) Close

func (s *Session) Close() error

func (*Session) Done

func (s *Session) Done() <-chan struct{}

func (*Session) Exited

func (s *Session) Exited() bool

func (*Session) HasForegroundProcess added in v0.12.14

func (s *Session) HasForegroundProcess() bool

HasForegroundProcess reports whether the PTY foreground process group is a command rather than the interactive shell itself.

func (*Session) ID

func (s *Session) ID() string

func (*Session) Resize

func (s *Session) Resize(cols, rows int) error

func (*Session) Shell

func (s *Session) Shell() string

func (*Session) Size

func (s *Session) Size() (cols, rows int)

func (*Session) Subscribe

func (s *Session) Subscribe() (snapshot []byte, ch <-chan []byte, cancel func())

Subscribe returns the scrollback captured so far plus a channel of subsequent output. The channel is closed when the session ends or when the subscriber falls too far behind; cancel must always be called.

func (*Session) Title

func (s *Session) Title() string

func (*Session) Write

func (s *Session) Write(p []byte) error

type Shell

type Shell struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func Shells

func Shells() []Shell

Shells lists the shells available on this host, the default one first.

Jump to

Keyboard shortcuts

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