Documentation
¶
Index ¶
- Constants
- 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 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 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 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.