Syntax
Options
Shell command to execute. Mutually exclusive with
--key. The command runs through your shell environment ($SHELL) with appropriate flags (zsh -ilc, bash -ic, or fallback -lc).Target worktree by name, path, or branch name. If not provided, lazyworktree auto-detects the worktree from the current directory.
Custom command key to trigger (e.g., ‘t’ for tmux, ‘z’ for zellij). Mutually exclusive with the positional command argument. The key must exist in your configuration’s
custom_commands.Environment Variables
The exec command sets the following environment variables (same as custom commands in the TUI):WORKTREE_PATH- The absolute path to the worktree directoryWORKTREE_BRANCH- The branch name of the worktreeWORKTREE_NAME- The basename of the worktree directoryREPO_NAME- The repository nameMAIN_WORKTREE_PATH- The path to the main worktree
Shell Mode
Commands run through your shell environment with appropriate flags:zsh:-ilcbash:-ic- Other shells:
-lc
Supported Command Types
- shell: Run arbitrary shell commands
- tmux: Create and manage tmux sessions
- zellij: Create and manage zellij sessions
- show-output: Run non-interactively and show stdout/stderr in pager
new-tab commands are not supported in CLI mode.