Skip to content

Feature request: Interactive picker should run when --execute is specified without a branch name #3370

Description

@gbcreation

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'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions