Documentation
¶
Overview ¶
Package tmuxexec implements the tmux terminal multiplexer adapter.
Index ¶
- type Client
- func (c *Client) AddWindows(ctx context.Context, target multiplexer.Target, ...) error
- func (c *Client) AttachOrSwitch(ctx context.Context, target multiplexer.Target, ...) error
- func (c *Client) Available() bool
- func (c *Client) CapturePane(ctx context.Context, target multiplexer.Target, ...) (string, error)
- func (c *Client) CreateSession(ctx context.Context, spec multiplexer.SessionSpec) error
- func (c *Client) CurrentSession(ctx context.Context) (multiplexer.Target, error)
- func (c *Client) HasSession(ctx context.Context, target multiplexer.Target) (bool, error)
- func (c *Client) InspectPane(ctx context.Context, target multiplexer.Target) (multiplexer.Pane, error)
- func (c *Client) KillSession(ctx context.Context, target multiplexer.Target) error
- func (c *Client) KillWindow(ctx context.Context, target multiplexer.Target) error
- func (c *Client) ListPanes(ctx context.Context) ([]multiplexer.Pane, error)
- func (c *Client) OpenSession(ctx context.Context, spec multiplexer.SessionSpec, ...) error
- func (c *Client) Paste(ctx context.Context, target multiplexer.Target, text []byte, ...) (retErr error)
- func (c *Client) RenameSession(ctx context.Context, target multiplexer.Target, newName string) error
- func (c *Client) ResolveTarget(ctx context.Context, raw string) (multiplexer.Pane, error)
- func (c *Client) SendKey(ctx context.Context, target multiplexer.Target, key multiplexer.NamedKey) error
- func (c *Client) SendLiteral(ctx context.Context, target multiplexer.Target, text string) error
- type ExecRunnerOptions
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements tmux operations over a Runner.
func NewDefault ¶
NewDefault creates a client that invokes the tmux executable.
func (*Client) AddWindows ¶
func (c *Client) AddWindows(ctx context.Context, target multiplexer.Target, windows []multiplexer.WindowSpec) error
AddWindows adds windows to an existing tmux session.
func (*Client) AttachOrSwitch ¶
func (c *Client) AttachOrSwitch(ctx context.Context, target multiplexer.Target, streams multiplexer.AttachStreams) error
AttachOrSwitch switches the active client inside tmux or attaches outside tmux. Window and pane selection is best-effort and ordered so the selected target is visible on entry: attach-session blocks until detach, so selection runs before it, while switch-client returns immediately, so selection runs after it.
func (*Client) CapturePane ¶
func (c *Client) CapturePane(ctx context.Context, target multiplexer.Target, opts multiplexer.CaptureOptions) (string, error)
CapturePane captures pane text.
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, spec multiplexer.SessionSpec) error
CreateSession creates a tmux session from a declarative specification.
func (*Client) CurrentSession ¶
CurrentSession returns the current tmux session, or an empty target outside tmux.
func (*Client) HasSession ¶
HasSession reports whether a tmux session exists.
func (*Client) InspectPane ¶
func (c *Client) InspectPane(ctx context.Context, target multiplexer.Target) (multiplexer.Pane, error)
InspectPane returns one resolved pane.
func (*Client) KillSession ¶
KillSession kills a tmux session.
func (*Client) KillWindow ¶
KillWindow kills one qualified tmux window.
func (*Client) OpenSession ¶
func (c *Client) OpenSession(ctx context.Context, spec multiplexer.SessionSpec, selection multiplexer.Target) error
OpenSession creates a missing session or opens an existing one. For an existing session, selection names the window or pane to show on entry.
func (*Client) Paste ¶
func (c *Client) Paste(ctx context.Context, target multiplexer.Target, text []byte, opts multiplexer.PasteOptions) (retErr error)
Paste loads bytes into a private tmux buffer and pastes it into a pane.
func (*Client) RenameSession ¶
func (c *Client) RenameSession(ctx context.Context, target multiplexer.Target, newName string) error
RenameSession renames a tmux session.
func (*Client) ResolveTarget ¶
ResolveTarget resolves a tmux target into a qualified pane.
func (*Client) SendKey ¶
func (c *Client) SendKey(ctx context.Context, target multiplexer.Target, key multiplexer.NamedKey) error
SendKey sends one validated tmux named-key token.
func (*Client) SendLiteral ¶
SendLiteral sends text without interpreting it as key names.
type ExecRunnerOptions ¶
type ExecRunnerOptions struct {
// Binary resolves the tmux executable for each command. Nil uses PATH.
Binary func(context.Context) (string, error)
// Environ returns the child environment. Nil inherits the process environment.
Environ func(context.Context) []string
// PrepareArgs can add server-selection arguments before execution.
PrepareArgs func([]string) []string
}
ExecRunnerOptions configures an executable-backed Runner.
type Runner ¶
type Runner interface {
Available() bool
Capture(ctx context.Context, args ...string) (stdout, stderr []byte, err error)
Input(ctx context.Context, input io.Reader, args ...string) (stdout, stderr []byte, err error)
Interactive(ctx context.Context, streams multiplexer.AttachStreams, args ...string) error
}
Runner executes tmux operations in captured, input-bearing, or interactive mode.
func NewExecRunner ¶
func NewExecRunner(options ExecRunnerOptions) Runner
NewExecRunner creates a Runner that invokes a configurable tmux executable.