CLI exec¶
Run shell commands or trigger custom command keys in a target worktree.
Examples¶
Shell command mode¶
lazyworktree exec --workspace=my-feature "make test"
lazyworktree exec -w my-feature "git status"
# Auto-detect worktree from current directory
cd ~/worktrees/repo/my-feature
lazyworktree exec "npm run build"
Custom command key mode¶
lazyworktree exec --key=t --workspace=my-feature
lazyworktree exec --key=_review --workspace=my-feature
lazyworktree exec -k z -w my-feature
# Auto-detect and trigger
cd ~/worktrees/repo/my-feature
lazyworktree exec --key=t
Behaviour¶
--workspace(-w) accepts worktree name or path.- Without
--workspace, lazyworktree auto-detects from current directory. - Accepts either positional shell command or
--keycustom action. - Palette-only custom commands still use their
_nameidentifier with--key. - Exposes the same managed
WORKTREE_*,REPO_*, and contextualLAZYWORKTREE_*environment variables as custom commands in the TUI. - Supports shell, tmux, zellij, herdr, and show-output command types.
new_tabis ignored for tmux and zellij commands, which have no terminal tab to open. Their configuredattachsetting decides whether the session opens in the current terminal or is created in the background with instructions for attaching later.new_tabis not supported for Herdr or plain commands in CLI mode.