Skip to content

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

Refactor Switch command doc to use doc attribute

Maximilian Roos3460a723c6ac
diff --git a/.claude-plugin/skills/worktrunk/reference/switch.md b/.claude-plugin/skills/worktrunk/reference/switch.md
index cfb9e695f..3a69f1029 100644
--- a/.claude-plugin/skills/worktrunk/reference/switch.md
+++ b/.claude-plugin/skills/worktrunk/reference/switch.md
@@ -1,7 +1,5 @@
# wt switch
-Change directory to a worktree, creating one if needed.
-
Worktrees are addressed by branch name; paths are computed from a configurable template. Unlike `git switch`, this navigates between worktrees rather than changing branches in place.
## Examples
@@ -61,6 +59,8 @@ To change which branch a worktree is on, use `git switch` inside that worktree.
wt switch - Switch to a worktree
+Change directory to a worktree, creating one if needed.
+
Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <span class=c>&lt;BRANCH&gt;</span> <b><span class=c>[--</span></b> <span class=c>&lt;EXECUTE_ARGS&gt;...</span><b><span class=c>]</span></b>
<b><span class=g>Arguments:</span></b>
diff --git a/docs/content/switch.md b/docs/content/switch.md
index b8c26394b..e2e7b5cf5 100644
--- a/docs/content/switch.md
+++ b/docs/content/switch.md
@@ -8,8 +8,6 @@ group = "Commands"
<!-- ⚠️ AUTO-GENERATED from `wt switch --help-page` — edit cli.rs to update -->
-Change directory to a worktree, creating one if needed.
-
<figure class="demo">
<picture>
<source srcset="/assets/docs/dark/wt-switch.gif" media="(prefers-color-scheme: dark)">
@@ -84,6 +82,8 @@ To change which branch a worktree is on, use `git switch` inside that worktree.
{% terminal() %}
wt switch - Switch to a worktree
+Change directory to a worktree, creating one if needed.
+
Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <span class=c>&lt;BRANCH&gt;</span> <b><span class=c>[--</span></b> <span class=c>&lt;EXECUTE_ARGS&gt;...</span><b><span class=c>]</span></b>
<b><span class=g>Arguments:</span></b>
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 549bc3b5e..311ad085f 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -243,9 +243,9 @@ pub(crate) struct Cli {
#[derive(Subcommand)]
pub(crate) enum Commands {
/// Switch to a worktree
- #[command(
- after_long_help = r#"Change directory to a worktree, creating one if needed.
-<!-- demo: wt-switch.gif 1600x900 -->
+ ///
+ /// Change directory to a worktree, creating one if needed.
+ #[command(after_long_help = r#"<!-- demo: wt-switch.gif 1600x900 -->
Worktrees are addressed by branch name; paths are computed from a configurable template. Unlike `git switch`, this navigates between worktrees rather than changing branches in place.
@@ -308,8 +308,7 @@ To change which branch a worktree is on, use `git switch` inside that worktree.
- [`wt list`](@/list.md) — View all worktrees
- [`wt remove`](@/remove.md) — Delete worktrees when done
- [`wt merge`](@/merge.md) — Integrate changes back to the default branch
-"#
- )]
+"#)]
Switch {
/// Branch name
///
@@ -1454,7 +1453,6 @@ fi
/// Manage configuration and shell integration
#[command(
- about = "Manage configuration and shell integration",
after_long_help = r#"Manages configuration, shell integration, and runtime settings.
Worktrunk uses two configuration files:
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 a5ca5798f..d07960b56 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -22,6 +22,8 @@ exit_code: 0
----- stderr -----
wt switch - Switch to a worktree
+Change directory to a worktree, creating one if needed.
+
Usage: wt switch [OPTIONS] <BRANCH> [-- <EXECUTE_ARGS>...]
Arguments:
@@ -82,7 +84,6 @@ Usage: wt switch [OPTIONS] <BRANCH> [--
-v, --verbose...
Show debug info (-v), or also write diagnostic report (-vv)
-Change directory to a worktree, creating one if needed.
Worktrees are addressed by branch name; paths are computed from a configurable template. Unlike git switch, this navigates between worktrees rather than changing branches in place.