multiplexer

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnExistsAttach = "attach"
	OnExistsKill   = "kill"
	OnExistsNew    = "new"
	OnExistsSwitch = "switch"
)

OnExists constants define how to handle existing sessions.

Variables

This section is empty.

Functions

func BuildContainerCommand added in v1.41.0

func BuildContainerCommand(cfg *config.ContainerCommand, command, worktreePath string, env map[string]string, interactive bool) (string, error)

BuildContainerCommand wraps a shell command in a container run invocation. The worktree path is auto-mounted to the working directory (default /workspace). Environment variables from env are forwarded into the container via -e flags. When interactive is true, -it flags are added for TTY allocation.

func BuildTmuxScript

func BuildTmuxScript(sessionName string, tmuxCfg *config.TmuxCommand, windows []ResolvedWindow, env map[string]string) string

BuildTmuxScript generates a shell script that creates or attaches to a tmux session. The script handles session existence based on tmuxCfg.OnExists and optionally attaches if tmuxCfg.Attach is true.

func BuildTmuxWindowCommand

func BuildTmuxWindowCommand(command string, env map[string]string) string

BuildTmuxWindowCommand builds the command string for a tmux window with environment exports.

func BuildZellijScript

func BuildZellijScript(sessionName string, zellijCfg *config.TmuxCommand, layoutPaths []string) string

BuildZellijScript generates a shell script that creates or attaches to a zellij session. The script handles session existence based on zellijCfg.OnExists and creates tabs from layoutPaths.

func BuildZellijTabLayout

func BuildZellijTabLayout(window ResolvedWindow) string

BuildZellijTabLayout generates a KDL layout for a single zellij tab.

func CleanupZellijLayouts

func CleanupZellijLayouts(paths []string)

CleanupZellijLayouts removes temporary layout files.

func DetectContainerRuntime added in v1.41.0

func DetectContainerRuntime(runtime string) (string, error)

DetectContainerRuntime returns the container runtime binary to use. If runtime is non-empty, it validates that the binary exists. Otherwise prefers podman, falls back to docker.

func ExportEnvCommand

func ExportEnvCommand(env map[string]string) string

ExportEnvCommand builds a shell command string that exports environment variables. Returns empty string if env is empty.

func KdlQuote

func KdlQuote(input string) string

KdlQuote quotes a string for use in KDL (Zellij layout format).

func ReadSessionFile

func ReadSessionFile(path, fallback string) string

ReadSessionFile reads the session name from a file, returning fallback if the file cannot be read or is empty.

func SanitizeTmuxSessionName

func SanitizeTmuxSessionName(name string) string

SanitizeTmuxSessionName removes invalid characters from a tmux session name.

func SanitizeZellijSessionName

func SanitizeZellijSessionName(name string) string

SanitizeZellijSessionName removes invalid characters from a zellij session name.

func ShellQuote

func ShellQuote(input string) string

ShellQuote quotes a string for use in a shell command. Returns an empty quoted string for empty input.

func WriteZellijLayouts

func WriteZellijLayouts(windows []ResolvedWindow) ([]string, error)

WriteZellijLayouts creates temporary layout files for each window. Returns the list of created file paths and an error if any operation failed. Caller is responsible for cleanup using CleanupZellijLayouts.

Types

type ResolvedWindow

type ResolvedWindow struct {
	Name    string
	Command string
	Cwd     string
}

ResolvedWindow represents a window/tab configuration after environment variable expansion.

func ResolveTmuxWindows

func ResolveTmuxWindows(windows []config.TmuxWindow, env map[string]string, defaultCwd string) ([]ResolvedWindow, bool)

ResolveTmuxWindows resolves window configurations by expanding environment variables. Returns the resolved windows and a boolean indicating success.

func WrapWindowCommandsForContainer added in v1.41.0

func WrapWindowCommandsForContainer(windows []ResolvedWindow, containerCfg *config.ContainerCommand, env map[string]string) ([]ResolvedWindow, error)

WrapWindowCommandsForContainer wraps each window's command in a container invocation. Windows with empty commands are left unchanged.

Jump to

Keyboard shortcuts

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