tmux

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LayoutTiled          string = "tiled"
	LayoutMainHorizontal string = "main-horizontal"
	LayoutEvenHorizontal string = "even-horizontal"
	LayoutMainVertical   string = "main-vertical"
	LayoutEvenVertical   string = "even-vertical"
)
View Source
const ColumnSep = "§"

Variables

View Source
var (
	ErrInvalidSplitType = errors.New("invalid split type")
	ErrInvalidFormat    = errors.New("invalid shell output format")
)

Functions

func ParsePaneType added in v0.2.0

func ParsePaneType(paneType string) string

ParsePaneType returns the tmux pane split type.

Types

type Target added in v0.1.2

type Target struct {
	Session string
	Window  string
	Pane    string
}

func (Target) Get added in v0.1.2

func (t Target) Get() string

type TmuxClient

type TmuxClient struct {
	Bin string
	Cmd shell.Commander
}

func (TmuxClient) Attach

func (t TmuxClient) Attach(
	session string,
	stdin, stdout, stderr *os.File,
) error

Attach attaches to a session.

func (TmuxClient) KillWindow

func (t TmuxClient) KillWindow(target Target) error

KillWindow kills a window in a session.

func (TmuxClient) ListPanes

func (t TmuxClient) ListPanes(target Target) ([]TmuxPane, error)

ListPanes returns a list of panes in a window.

func (TmuxClient) ListSessions

func (t TmuxClient) ListSessions() ([]TmuxSession, error)

ListSessions returns a list of sessions and their information.

func (TmuxClient) ListWindows

func (t TmuxClient) ListWindows(target Target) ([]TmuxWindow, error)

ListWindows returns a list of windows and their information.

func (TmuxClient) NewPane

func (t TmuxClient) NewPane(target Target, dir, split string) (string, error)

NewPane creates a new split in a session's window.

func (TmuxClient) NewSession

func (t TmuxClient) NewSession(name, dir, windowName string) (string, error)

NewSession creates a new session with optional name and directory.

func (TmuxClient) NewWindow

func (t TmuxClient) NewWindow(target Target, name, dir string) (string, error)

NewWindow creates a new window with optional name and directory.

func (TmuxClient) RenumberWindows

func (t TmuxClient) RenumberWindows(session string) error

RenumberWindows renumbers windows' index in a session.

func (TmuxClient) SelectLayout

func (t TmuxClient) SelectLayout(target Target, layout string) (string, error)

SelectLayout selects a layout for a window.

func (TmuxClient) SelectPane

func (t TmuxClient) SelectPane(target Target) error

SelectPane selects a pane in a window.

func (TmuxClient) SelectWindow

func (t TmuxClient) SelectWindow(target Target) error

SelectWindow selects a window in a session.

func (TmuxClient) SendKeys added in v0.1.2

func (t TmuxClient) SendKeys(target Target, command string) error

SendKeys sends key-strokes to a target.

func (TmuxClient) SessionExists

func (t TmuxClient) SessionExists(name string) bool

SessionExists checks if a session exists.

func (TmuxClient) SessionName

func (t TmuxClient) SessionName() (string, error)

SessionName returns the current session name.

func (TmuxClient) SetEnv

func (t TmuxClient) SetEnv(session, key, value string) (string, error)

SetEnv sets an environment variable in a session.

func (TmuxClient) StopSession

func (t TmuxClient) StopSession(target Target) (string, error)

StopSession stops a session.

func (TmuxClient) SwitchClient

func (t TmuxClient) SwitchClient(session string) error

SwitchClient switches to a client.

type TmuxPane

type TmuxPane struct {
	Path    string `format:"pane_current_path"`
	Command string `format:"pane_current_command"`
}

type TmuxSession

type TmuxSession struct {
	ID           string    `format:"session_id"`
	Name         string    `format:"session_name"`
	Path         string    `format:"session_path"`
	Attached     bool      `format:"session_attached"`
	Marked       bool      `format:"session_marked"`
	Windows      int       `format:"session_windows"`
	Stack        string    `format:"session_stack"`
	Alerts       string    `format:"session_alerts"`
	Created      time.Time `format:"session_created"`
	Activity     time.Time `format:"session_activity"`
	LastAttached time.Time `format:"session_last_attached"`
}

type TmuxWindow

type TmuxWindow struct {
	ID     string `format:"window_id"`
	Name   string `format:"window_name"`
	Layout string `format:"window_layout"`
	Path   string `format:"pane_current_path"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳