shell

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package shell renders an interactive container exec session as a panel inside the TUI. It feeds the remote PTY's byte stream through a virtual-terminal emulator (vt10x) and draws the emulator's screen grid each frame, forwarding keystrokes back to the session. Unlike a terminal hand-off, the app's header and footer stay on screen for the lifetime of the shell.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCmd

func ReadCmd(s docker.ExecSession) tea.Cmd

ReadCmd reads the next chunk of remote output. A read of zero bytes (or any error) closes the panel.

func ResizeCmd

func ResizeCmd(s docker.ExecSession, rows, cols int) tea.Cmd

ResizeCmd updates the remote TTY window size (rows × cols).

Types

type ClosedMsg

type ClosedMsg struct{ Err error }

ClosedMsg signals the session ended (remote process exited or the connection dropped). A non-EOF error is surfaced to the user.

type Model

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

Model is the embedded-terminal panel.

func New

func New() Model

New returns an empty shell panel; call Open to attach a session.

func (*Model) CloseSession

func (m *Model) CloseSession()

CloseSession ends the underlying session (used when the user detaches). The input pump is stopped first so it can't write to a closing connection.

func (Model) Closed

func (m Model) Closed() bool

Closed reports whether the session has ended.

func (Model) ExitErr

func (m Model) ExitErr() error

ExitErr returns the error that ended the session, if it ended abnormally (a clean exit or EOF returns nil).

func (*Model) Open

func (m *Model) Open(session docker.ExecSession, title string) tea.Cmd

Open attaches an exec session and starts pumping its output. The terminal is sized to the current panel dimensions (set by a prior SetSize). It returns the commands that read output and push the initial window size to the remote TTY.

func (Model) ResizeRemoteCmd

func (m Model) ResizeRemoteCmd() tea.Cmd

ResizeRemoteCmd pushes the current grid size to the remote TTY; used after a window resize. It returns nil when there is nothing to resize.

func (Model) SendKey

func (m Model) SendKey(msg tea.KeyMsg) []byte

SendKey encodes a key event and enqueues it for the input pump, preserving typing order. It returns the bytes enqueued (nil when the key has no terminal representation, the session is gone, or the buffer is full).

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize records the panel area (header/footer-excluded body) and resizes the inner terminal grid to fit inside the border.

func (Model) Title

func (m Model) Title() string

Title returns the display title (container name) of the active session.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update applies streamed output and session-closed events.

func (Model) View

func (m Model) View() string

View draws the terminal grid inside a titled border filling the panel area.

type OutputMsg

type OutputMsg struct{ Data []byte }

OutputMsg carries a chunk of remote output read from the session.

Jump to

Keyboard shortcuts

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