Description
When wt switch is called without a branch name, it opens the interactive picker to browse and select a worktree. However, when --execute / -x is combined with wt switch and no branch name is provided, the picker is not shown. Instead, the command errors out with a missing <BRANCH> argument.
wt switch # ✅ opens picker
wt switch -x claude # ❌ error: missing <BRANCH>
wt switch feat/my -x claude # ✅ switches and runs claude
Expected behaviour
When -x is provided but no branch name is given, wt switch should open the interactive picker as usual, and run the execute command after the user selects a worktree.
wt switch -x claude # ✅ opens picker → user selects worktree → claude launches
This would make -x composable with the picker, enabling workflows such as:
wt switch -x claude # pick a worktree, launch Claude
wt switch -x 'claude --continue' # pick a worktree, resume Claude session
wt switch -x code # pick a worktree, open VS Code
It also unlocks cleaner alias definitions:
[aliases]
cc = "wt switch -x 'claude --continue'"
Description
When
wt switchis called without a branch name, it opens the interactive picker to browse and select a worktree. However, when--execute / -xis combined withwt switchand no branch name is provided, the picker is not shown. Instead, the command errors out with a missing<BRANCH>argument.Expected behaviour
When
-xis provided but no branch name is given,wt switchshould open the interactive picker as usual, and run the execute command after the user selects a worktree.wt switch -x claude # ✅ opens picker → user selects worktree → claude launchesThis would make
-xcomposable with the picker, enabling workflows such as:It also unlocks cleaner alias definitions: