Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

docs: Expand execute option docs with examples and use case

Maximilian Roos5026d13fa8c1
diff --git a/README.md b/README.md
index 46732af98..12429a121 100644
--- a/README.md
+++ b/README.md
@@ -484,6 +484,14 @@ Options:
-x, --execute <EXECUTE>
Command to run after switch
+ Replaces the wt process with the command after switching, giving it full terminal control. Useful for launching editors, AI agents, or other interactive tools.
+
+ Especially useful in shell aliases to create a worktree and start working in one command:
+
+ alias wsc='wt switch --create --execute=claude'
+
+ Then wsc feature-branch creates the worktree and launches Claude Code.
+
-f, --force
Skip approval prompts
diff --git a/docs/content/switch.md b/docs/content/switch.md
index fadfee168..2fe50e6c9 100644
--- a/docs/content/switch.md
+++ b/docs/content/switch.md
@@ -102,6 +102,14 @@ Options:
-x, --execute <EXECUTE>
Command to run after switch
+ Replaces the wt process with the command after switching, giving it full terminal control. Useful for launching editors, AI agents, or other interactive tools.
+
+ Especially useful in shell aliases to create a worktree and start working in one command:
+
+ alias wsc='wt switch --create --execute=claude'
+
+ Then wsc feature-branch creates the worktree and launches Claude Code.
+
-f, --force
Skip approval prompts
diff --git a/src/cli.rs b/src/cli.rs
index a580df73a..e0c323224 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1063,6 +1063,19 @@ Arguments resolve by checking the filesystem before git branches:
base: Option<String>,
/// Command to run after switch
+ ///
+ /// Replaces the wt process with the command after switching, giving
+ /// it full terminal control. Useful for launching editors, AI agents,
+ /// or other interactive tools.
+ ///
+ /// Especially useful in shell aliases to create a worktree and start
+ /// working in one command:
+ ///
+ /// ```sh
+ /// alias wsc='wt switch --create --execute=claude'
+ /// ```
+ ///
+ /// Then `wsc feature-branch` creates the worktree and launches Claude Code.
#[arg(short = 'x', long)]
execute: Option<String>,
diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
index 37fa2dc94..54047cf4c 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -36,7 +36,15 @@ Usage: wt switch [OPTIONS] <BRANCH>
Defaults to default branch.
-x, --execute <EXECUTE>
- Command to run after switch
+ Command to run after switch
+ 
+ Replaces the wt process with the command after switching, giving it full terminal control. Useful for launching editors, AI agents, or other interactive tools.
+ 
+ Especially useful in shell aliases to create a worktree and start working in one command:
+ 
+ alias wsc='wt switch --create --execute=claude'
+ 
+ Then wsc feature-branch creates the worktree and launches Claude Code.
-f, --force
Skip approval prompts