Skip to content

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

feat: Improve help messages for subcommands

Maximilian Roos6e99a1137e75
diff --git a/src/cli.rs b/src/cli.rs
index 0a5978b7c..b86132ca4 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -294,7 +294,9 @@ pub enum StandaloneCommand {
/// Squash commits with LLM-generated message
Squash {
- /// Target branch (defaults to default branch)
+ /// Target branch
+ ///
+ /// Defaults to default branch.
#[arg(add = crate::completion::branch_value_completer())]
target: Option<String>,
@@ -312,7 +314,9 @@ pub enum StandaloneCommand {
/// Automatically stashes non-conflicting edits in the target worktree before
/// the push and restores them afterward so other agents' changes stay intact.
Push {
- /// Target branch (defaults to default branch)
+ /// Target branch
+ ///
+ /// Defaults to default branch.
#[arg(add = crate::completion::branch_value_completer())]
target: Option<String>,
@@ -323,7 +327,9 @@ pub enum StandaloneCommand {
/// Rebase onto target
Rebase {
- /// Target branch (defaults to default branch)
+ /// Target branch
+ ///
+ /// Defaults to default branch.
#[arg(add = crate::completion::branch_value_completer())]
target: Option<String>,
},
@@ -485,7 +491,7 @@ Note: `locked` and `prunable` are top-level fields on worktree objects, not in s
#[arg(long)]
branches: bool,
- /// Include remote branches from primary remote
+ /// Include primary remote branches
#[arg(long)]
remotes: bool,
@@ -584,11 +590,13 @@ wt remove @ # Remove current worktree
#[arg(short = 'c', long)]
create: bool,
- /// Base branch (defaults to default branch)
+ /// Base branch
+ ///
+ /// Defaults to default branch.
#[arg(short = 'b', long, add = crate::completion::branch_value_completer())]
base: Option<String>,
- /// Execute command after switching
+ /// Command to run after switch
#[arg(short = 'x', long)]
execute: Option<String>,
@@ -710,7 +718,9 @@ Skip all hooks:
wt merge --no-verify
```"#)]
Merge {
- /// Target branch (defaults to default branch)
+ /// Target branch
+ ///
+ /// Defaults to default branch.
#[arg(add = crate::completion::branch_value_completer())]
target: Option<String>,
diff --git a/tests/snapshots/integration__integration_tests__help__help_list.snap b/tests/snapshots/integration__integration_tests__help__help_list.snap
index 25d231379..a327f3f03 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list.snap
@@ -25,8 +25,8 @@ Options:
--branches
Include branches without worktrees
- --remotes
- Include remote branches from primary remote
+ --remotes
+ Include primary remote branches
--full
Show CI, conflicts, diffs
diff --git a/tests/snapshots/integration__integration_tests__help__help_switch.snap b/tests/snapshots/integration__integration_tests__help__help_switch.snap
index a3649c222..43cbd77bc 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch.snap
@@ -21,10 +21,12 @@ Options:
Create a new branch
-b, --base <BASE>
- Base branch (defaults to default branch)
+ Base branch
+
+ Defaults to default branch.
-x, --execute <EXECUTE>
- Execute command after switching
+ Command to run after switch
-f, --force
Skip approval prompts
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index 3ad73adcd..89f92419b 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -12,13 +12,13 @@ info:
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpIGoCm6/test-gitconfig
+ GIT_CONFIG_GLOBAL: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpEYPsxm/test-gitconfig
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpIGoCm6/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpEYPsxm/test-config.toml
---
success: true
exit_code: 0
@@ -263,7 +263,7 @@ complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_f
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from squash" -s f -l force -d 'Skip approval prompts'
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from squash" -l no-verify -d 'Skip pre-commit hooks'
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from squash" -s v -l verbose -d 'Show commands and debug info'
-complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from squash" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from squash" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from push" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from push" -l config -d 'User config file path' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from push" -l allow-merge-commits -d 'Allow merge commits'
@@ -272,7 +272,7 @@ complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_f
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from rebase" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from rebase" -l config -d 'User config file path' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from rebase" -s v -l verbose -d 'Show commands and debug info'
-complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from rebase" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from rebase" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -l config -d 'User config file path' -r -F
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -s v -l verbose -d 'Show commands and debug info'
@@ -282,14 +282,14 @@ json\t'JSON output'"
complete -c wt -n "__fish_wt_using_subcommand list" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand list" -l config -d 'User config file path' -r -F
complete -c wt -n "__fish_wt_using_subcommand list" -l branches -d 'Include branches without worktrees'
-complete -c wt -n "__fish_wt_using_subcommand list" -l remotes -d 'Include remote branches from primary remote'
+complete -c wt -n "__fish_wt_using_subcommand list" -l remotes -d 'Include primary remote branches'
complete -c wt -n "__fish_wt_using_subcommand list" -l full -d 'Show CI, conflicts, diffs'
complete -c wt -n "__fish_wt_using_subcommand list" -l progressive -d 'Force progressive (or --no-progressive)'
complete -c wt -n "__fish_wt_using_subcommand list" -l no-progressive -d 'Force buffered rendering'
complete -c wt -n "__fish_wt_using_subcommand list" -s v -l verbose -d 'Show commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand list" -s h -l help -d 'Print help (see more with \'--help\')'
-complete -c wt -n "__fish_wt_using_subcommand switch" -s b -l base -f -d 'Base branch (defaults to default branch)' -r
-complete -c wt -n "__fish_wt_using_subcommand switch" -s x -l execute -d 'Execute command after switching' -r
+complete -c wt -n "__fish_wt_using_subcommand switch" -s b -l base -f -d 'Base branch' -r
+complete -c wt -n "__fish_wt_using_subcommand switch" -s x -l execute -d 'Command to run after switch' -r
complete -c wt -n "__fish_wt_using_subcommand switch" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand switch" -l config -d 'User config file path' -r -F
complete -c wt -n "__fish_wt_using_subcommand switch" -s c -l create -d 'Create a new branch'
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index 1765b5beb..69b1243f7 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -12,13 +12,13 @@ info:
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpWiQOW2/test-gitconfig
+ GIT_CONFIG_GLOBAL: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpm9QNFk/test-gitconfig
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpWiQOW2/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpm9QNFk/test-config.toml
---
success: true
exit_code: 0
@@ -445,9 +445,9 @@ _arguments "${_arguments_options[@]}" : \
'--no-verify[Skip pre-commit hooks]' \
'-v[Show commands and debug info]' \
'--verbose[Show commands and debug info]' \
-'-h[Print help]' \
-'--help[Print help]' \
-'::target -- Target branch (defaults to default branch):_default' \
+'-h[Print help (see more with '\''--help'\'')]' \
+'--help[Print help (see more with '\''--help'\'')]' \
+'::target -- Target branch:_default' \
&& ret=0
;;
(push)
@@ -459,7 +459,7 @@ _arguments "${_arguments_options[@]}" : \
'--verbose[Show commands and debug info]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
-'::target -- Target branch (defaults to default branch):_default' \
+'::target -- Target branch:_default' \
&& ret=0
;;
(rebase)
@@ -468,9 +468,9 @@ _arguments "${_arguments_options[@]}" : \
'--config=[User config file path]:path:_files' \
'-v[Show commands and debug info]' \
'--verbose[Show commands and debug info]' \
-'-h[Print help]' \
-'--help[Print help]' \
-'::target -- Target branch (defaults to default branch):_default' \
+'-h[Print help (see more with '\''--help'\'')]' \
+'--help[Print help (see more with '\''--help'\'')]' \
+'::target -- Target branch:_default' \
&& ret=0
;;
(select)
@@ -494,7 +494,7 @@ json\:"JSON output"))' \
'-C+[Change working directory]:path:_files' \
'--config=[User config file path]:path:_files' \
'--branches[Include branches without worktrees]' \
-'--remotes[Include remote branches from primary remote]' \
+'--remotes[Include primary remote branches]' \
'--full[Show CI, conflicts, diffs]' \
'--progressive[Force progressive (or --no-progressive)]' \
'--no-progressive[Force buffered rendering]' \
@@ -506,10 +506,10 @@ json\:"JSON output"))' \
;;
(switch)
_arguments "${_arguments_options[@]}" : \
-'-b+[Base branch (defaults to default branch)]:BASE:_default' \
-'--base=[Base branch (defaults to default branch)]:BASE:_default' \
-'-x+[Execute command after switching]:EXECUTE:_default' \
-'--execute=[Execute command after switching]:EXECUTE:_default' \
+'-b+[Base branch]:BASE:_default' \
+'--base=[Base branch]:BASE:_default' \
+'-x+[Command to run after switch]:EXECUTE:_default' \
+'--execute=[Command to run after switch]:EXECUTE:_default' \
'-C+[Change working directory]:path:_files' \
'--config=[User config file path]:path:_files' \
'-c[Create a new branch]' \
@@ -554,7 +554,7 @@ _arguments "${_arguments_options[@]}" : \
'--verbose[Show commands and debug info]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
-'::target -- Target branch (defaults to default branch):_default' \
+'::target -- Target branch:_default' \
&& ret=0
;;
esac