terminal

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 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

func Environment

func Environment(base []string, settings protocol.TerminalSettings) []string

Environment returns the Node's terminal environment with the saved variables applied over it. MyGo merges these values into the process environment, so the account's home must replace a parent's ZDOTDIR when the launch has no explicit startup directory.

func Shells

func Shells(environment []string, distributions []protocol.WslDistribution) []protocol.TerminalShell

Shells discovers the shells a terminal can start on this Node, ordered by path. distributions are the WSL distributions to offer through wsl.exe; they only apply on Windows.

func ValidateViewport

func ValidateViewport(viewport protocol.TerminalViewport) error

ValidateViewport checks a requested terminal size before any launch work.

Types

type Launch

type Launch struct {
	ID          protocol.TerminalID
	Caller      protocol.NodeID
	Worktree    protocol.WorktreeID
	Root        string
	Tool        *protocol.TerminalToolsTool
	Access      protocol.ProcessAccess
	Command     []string
	Environment []string
	// Settings are the saved terminal settings: their environment applies to
	// every local launch and their shell to one without a tool or command.
	Settings protocol.TerminalSettings
	// Sandbox confines the program of a workspace terminal: it returns the
	// wrapped command, the variables that follow the terminal's own and the
	// release of its private state.
	Sandbox func(root string, command, environment []string) ([]string, []string, func(), error)
	// SSH and Connection replace the local program with a remote shell. The
	// terminal then has no worktree, access policy or directory.
	SSH        *protocol.SshID
	Connection *SSHConnection
	Viewport   protocol.TerminalViewport
	Appearance protocol.TerminalAppearance
	Revision   uint64
}

type SSHConnection

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

SSHConnection is the interactive shell of one SSH terminal. It owns its client: closing the terminal closes the session and the connection.

func OpenSSH

func OpenSSH(client *cryptossh.Client, viewport protocol.TerminalViewport) (*SSHConnection, error)

OpenSSH requests a terminal and a shell on an authenticated connection. The caller keeps ownership of the client until the terminal starts.

func (*SSHConnection) Close

func (connection *SSHConnection) Close() error

func (*SSHConnection) Read

func (connection *SSHConnection) Read(buffer []byte) (int, error)

func (*SSHConnection) ResizePixels

func (connection *SSHConnection) ResizePixels(columns, rows, cellWidth, cellHeight int) error

ResizePixels sends the window change with its pixel size.

func (*SSHConnection) Write

func (connection *SSHConnection) Write(body []byte) (int, error)

type Service

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

func New

func New(ctx context.Context, node protocol.NodeID, changed func(context.Context, protocol.TerminalInfo)) *Service

func (*Service) Active

func (service *Service) Active(worktree protocol.WorktreeID) bool

func (*Service) Appearance

func (*Service) Claim

func (service *Service) Claim(caller protocol.NodeID, id protocol.TerminalID, expected uint64) (protocol.TerminalInfo, error)

func (*Service) Close

func (service *Service) Close() error

func (*Service) CloseTerminal

func (service *Service) CloseTerminal(worktree *protocol.WorktreeID, id protocol.TerminalID) (protocol.TerminalInfo, error)

CloseTerminal closes a worktree's terminal, or an SSH terminal when worktree is nil.

func (*Service) Info

func (service *Service) Info(id protocol.TerminalID) (protocol.TerminalInfo, error)

func (*Service) Input

func (*Service) List

func (service *Service) List(worktree protocol.WorktreeID) []protocol.TerminalInfo

func (*Service) Resize

func (*Service) Snapshot

func (service *Service) Snapshot(id protocol.TerminalID) (protocol.TerminalSnapshot, error)

func (*Service) Start

func (service *Service) Start(ctx context.Context, launch Launch) (protocol.TerminalInfo, error)

func (*Service) Subscribe

func (service *Service) Subscribe(id protocol.TerminalID) (link.Subscription, error)

func (*Service) Tools

func (service *Service) Tools(root string, environment []string) []protocol.TerminalToolsToolInfo

Jump to

Keyboard shortcuts

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