Skip to content

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

feat: Enhance CLI, PTY, and documentation with improved user experience

Maximilian Roos98e0078188e0
diff --git a/src/cli.rs b/src/cli.rs
index 006340c9d..271bef576 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1,4 +1,4 @@
-use clap::{ArgAction, Parser, Subcommand};
+use clap::{Parser, Subcommand};
use std::sync::OnceLock;
use worktrunk::HookType;
@@ -25,7 +25,7 @@ fn version_str() -> &'static str {
pub enum OutputFormat {
/// Human-readable table format
Table,
- /// Machine-readable JSON with display fields (includes styled unicode for rendering)
+ /// JSON output
Json,
}
@@ -107,7 +107,7 @@ Oil Shell (~/.config/oil/oshrc):
#[arg(short, long)]
force: bool,
- /// Command name (default: 'wt')
+ /// Command name
#[arg(long, default_value = DEFAULT_COMMAND_NAME)]
command_name: String,
},
@@ -209,7 +209,7 @@ pub enum Commands {
/// Shell to generate code for
shell: Shell,
- /// Command name (default: 'wt')
+ /// Command name
#[arg(long, default_value = DEFAULT_COMMAND_NAME)]
command_name: String,
},
@@ -519,11 +519,11 @@ Skip pre-merge commands:
#[arg(add = crate::completion::branch_value_completer())]
target: Option<String>,
- /// Don't squash commits
- #[arg(long = "no-squash", action = ArgAction::SetFalse, default_value_t = true)]
- squash_enabled: bool,
+ /// Skip commit squashing
+ #[arg(long = "no-squash")]
+ no_squash: bool,
- /// Push without transformations
+ /// Skip commit, squash, and rebase
#[arg(long)]
no_commit: bool,
@@ -531,7 +531,7 @@ Skip pre-merge commands:
#[arg(long = "no-remove")]
no_remove: bool,
- /// Skip pre-merge hooks
+ /// Skip project hooks
#[arg(long)]
no_verify: bool,
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 9ca58be4c..8d845d41b 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -60,7 +60,7 @@ impl<'a> MergeCommandCollector<'a> {
pub fn handle_merge(
target: Option<&str>,
- squash_enabled: bool,
+ no_squash: bool,
no_commit: bool,
no_remove: bool,
no_verify: bool,
@@ -85,7 +85,7 @@ pub fn handle_merge(
}
// --no-commit implies --no-squash (validation above ensures --no-remove is already set)
- let squash_enabled = if no_commit { false } else { squash_enabled };
+ let squash_enabled = !no_squash && !no_commit;
// Get target branch (default to default branch if not provided)
let target_branch = repo.resolve_target_branch(target)?;
diff --git a/src/main.rs b/src/main.rs
index 26650b15d..93cf22a54 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -310,7 +310,7 @@ fn main() {
}
Commands::Merge {
target,
- squash_enabled,
+ no_squash,
no_commit,
no_remove,
no_verify,
@@ -318,7 +318,7 @@ fn main() {
tracked_only,
} => handle_merge(
target.as_deref(),
- squash_enabled,
+ no_squash,
no_commit,
no_remove,
no_verify,
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index 52f6f5695..12e3d8a5b 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjMnKcX/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp7bMDFm/test-config.toml
---
success: true
exit_code: 0
@@ -194,7 +194,7 @@ complete -c wt -n "__fish_wt_needs_command" -f -a "list" -d 'List worktrees and
complete -c wt -n "__fish_wt_needs_command" -f -a "switch" -d 'Switch to a worktree'
complete -c wt -n "__fish_wt_needs_command" -f -a "remove" -d 'Finish current worktree, returning to primary if current'
complete -c wt -n "__fish_wt_needs_command" -f -a "merge" -d 'Merge worktree into target branch'
-complete -c wt -n "__fish_wt_using_subcommand init" -l command-name -d 'Command name (default: \'wt\')' -r
+complete -c wt -n "__fish_wt_using_subcommand init" -l command-name -d 'Command name' -r
complete -c wt -n "__fish_wt_using_subcommand init" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand init" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand init" -s h -l help -d 'Print help'
@@ -217,7 +217,7 @@ complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -l shell -d 'Shell to configure' -r -f -a "bash\t''
fish\t''
zsh\t''"
-complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -l command-name -d 'Command name (default: \'wt\')' -r
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -l command-name -d 'Command name' -r
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s f -l force -d 'Skip confirmation prompt'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from shell" -s v -l verbose -d 'Show git commands and debug info'
@@ -267,7 +267,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 select" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand beta; and __fish_seen_subcommand_from select" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c wt -n "__fish_wt_using_subcommand list" -l format -d 'Output format' -r -f -a "table\t'Human-readable table format'
-json\t'Machine-readable JSON with display fields (includes styled unicode for rendering)'"
+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 branches -d 'Include branches without worktrees'
complete -c wt -n "__fish_wt_using_subcommand list" -l full -d 'Show CI, conflicts, and full diffs'
@@ -286,10 +286,10 @@ complete -c wt -n "__fish_wt_using_subcommand remove" -l no-delete-branch -d 'Ke
complete -c wt -n "__fish_wt_using_subcommand remove" -s v -l verbose -d 'Show git commands and debug info'
complete -c wt -n "__fish_wt_using_subcommand remove" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand merge" -s C -d 'Change working directory' -r -F
-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-squash -d 'Don\'t squash commits'
-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-commit -d 'Push without transformations'
+complete -c wt -n "__fish_wt_using_subcommand merge" -l no-squash -d 'Skip commit squashing'
+complete -c wt -n "__fish_wt_using_subcommand merge" -l no-commit -d 'Skip commit, squash, and rebase'
complete -c wt -n "__fish_wt_using_subcommand merge" -l no-remove -d 'Keep worktree after merge'
-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-verify -d 'Skip pre-merge hooks'
+complete -c wt -n "__fish_wt_using_subcommand merge" -l no-verify -d 'Skip project hooks'
complete -c wt -n "__fish_wt_using_subcommand merge" -s f -l force -d 'Skip approval prompts'
complete -c wt -n "__fish_wt_using_subcommand merge" -l tracked-only -d 'Stage tracked files only'
complete -c wt -n "__fish_wt_using_subcommand merge" -s v -l verbose -d 'Show git commands and debug info'
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index 9ae7a67fa..2b1e45c18 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpeaTQjA/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp2UKDFi/test-config.toml
---
success: true
exit_code: 0
@@ -176,7 +176,7 @@ _wt() {
case $line[1] in
(init)
_arguments "${_arguments_options[@]}" : \
-'--command-name=[Command name (default\: '\''wt'\'')]:COMMAND_NAME:_default' \
+'--command-name=[Command name]:COMMAND_NAME:_default' \
'-C+[Change working directory]:path:_files' \
'-v[Show git commands and debug info]' \
'--verbose[Show git commands and debug info]' \
@@ -232,7 +232,7 @@ _arguments "${_arguments_options[@]}" : \
(shell)
_arguments "${_arguments_options[@]}" : \
'--shell=[Shell to configure]:SHELL:(bash fish zsh)' \
-'--command-name=[Command name (default\: '\''wt'\'')]:COMMAND_NAME:_default' \
+'--command-name=[Command name]:COMMAND_NAME:_default' \
'-C+[Change working directory]:path:_files' \
'-f[Skip confirmation prompt]' \
'--force[Skip confirmation prompt]' \
@@ -360,7 +360,7 @@ esac
(list)
_arguments "${_arguments_options[@]}" : \
'--format=[Output format]:FORMAT:((table\:"Human-readable table format"
-json\:"Machine-readable JSON with display fields (includes styled unicode for rendering)"))' \
+json\:"JSON output"))' \
'-C+[Change working directory]:path:_files' \
'--branches[Include branches without worktrees]' \
'--full[Show CI, conflicts, and full diffs]' \
@@ -403,10 +403,10 @@ _arguments "${_arguments_options[@]}" : \
(merge)
_arguments "${_arguments_options[@]}" : \
'-C+[Change working directory]:path:_files' \
-'--no-squash[Don'\''t squash commits]' \
-'--no-commit[Push without transformations]' \
+'--no-squash[Skip commit squashing]' \
+'--no-commit[Skip commit, squash, and rebase]' \
'--no-remove[Keep worktree after merge]' \
-'--no-verify[Skip pre-merge hooks]' \
+'--no-verify[Skip project hooks]' \
'-f[Skip approval prompts]' \
'--force[Skip approval prompts]' \
'--tracked-only[Stage tracked files only]' \