Documentation
¶
Index ¶
- Constants
- func BuildContainerCommand(cfg *config.ContainerCommand, command, worktreePath string, ...) (string, error)
- func BuildTmuxScript(sessionName string, tmuxCfg *config.TmuxCommand, windows []ResolvedWindow, ...) string
- func BuildTmuxWindowCommand(command string, env map[string]string) string
- func BuildZellijScript(sessionName string, zellijCfg *config.TmuxCommand, layoutPaths []string) string
- func BuildZellijTabLayout(window ResolvedWindow) string
- func CleanupZellijLayouts(paths []string)
- func DetectContainerRuntime(runtime string) (string, error)
- func ExportEnvCommand(env map[string]string) string
- func KdlQuote(input string) string
- func ReadSessionFile(path, fallback string) string
- func SanitizeTmuxSessionName(name string) string
- func SanitizeZellijSessionName(name string) string
- func ShellQuote(input string) string
- func WriteZellijLayouts(windows []ResolvedWindow) ([]string, error)
- type ResolvedWindow
Constants ¶
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 ¶
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
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 ¶
ExportEnvCommand builds a shell command string that exports environment variables. Returns empty string if env is empty.
func ReadSessionFile ¶
ReadSessionFile reads the session name from a file, returning fallback if the file cannot be read or is empty.
func SanitizeTmuxSessionName ¶
SanitizeTmuxSessionName removes invalid characters from a tmux session name.
func SanitizeZellijSessionName ¶
SanitizeZellijSessionName removes invalid characters from a zellij session name.
func ShellQuote ¶
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 ¶
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.