Skip to content

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

Switch from `no-verify` to `verify` flag

Maximilian Roosb673e781d15f
diff --git a/src/cli.rs b/src/cli.rs
index a2966e3e4..1ec350ef2 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -196,8 +196,8 @@ pub enum StandaloneCommand {
force: bool,
/// Skip pre-commit hooks
- #[arg(long)]
- no_verify: bool,
+ #[arg(long = "no-verify", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ verify: bool,
},
/// Squash commits with LLM-generated message
@@ -211,8 +211,8 @@ pub enum StandaloneCommand {
force: bool,
/// Skip pre-commit hooks
- #[arg(long)]
- no_verify: bool,
+ #[arg(long = "no-verify", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ verify: bool,
},
/// Push changes to target branch
@@ -470,8 +470,8 @@ Use '@' for current HEAD, '-' for previous, '^' for main:
force: bool,
/// Skip project hooks
- #[arg(long)]
- no_verify: bool,
+ #[arg(long = "no-verify", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ verify: bool,
},
/// Finish current worktree, returning to primary if current
@@ -532,12 +532,12 @@ Switch to default in primary:
worktrees: Vec<String>,
/// Keep branch after removal
- #[arg(long = "no-delete-branch")]
- no_delete_branch: bool,
+ #[arg(long = "no-delete-branch", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ delete_branch: bool,
/// Run removal in foreground
- #[arg(long = "no-background")]
- no_background: bool,
+ #[arg(long = "no-background", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ background: bool,
},
/// Merge worktree into target branch
@@ -597,20 +597,20 @@ Skip pre-merge commands:
target: Option<String>,
/// Skip commit squashing
- #[arg(long = "no-squash")]
- no_squash: bool,
+ #[arg(long = "no-squash", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ squash: bool,
/// Skip commit, squash, and rebase
- #[arg(long)]
- no_commit: bool,
+ #[arg(long = "no-commit", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ commit: bool,
/// Keep worktree after merge
- #[arg(long = "no-remove")]
- no_remove: bool,
+ #[arg(long = "no-remove", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ remove: bool,
/// Skip project hooks
- #[arg(long)]
- no_verify: bool,
+ #[arg(long = "no-verify", action = clap::ArgAction::SetFalse, default_value_t = true)]
+ verify: bool,
/// Skip approval prompts
#[arg(short, long)]
diff --git a/src/main.rs b/src/main.rs
index da5748077..899329011 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -187,14 +187,12 @@ fn main() {
StandaloneCommand::RunHook { hook_type, force } => {
handle_standalone_run_hook(hook_type, force)
}
- StandaloneCommand::Commit { force, no_verify } => {
- handle_standalone_commit(force, no_verify)
- }
+ StandaloneCommand::Commit { force, verify } => handle_standalone_commit(force, !verify),
StandaloneCommand::Squash {
target,
force,
- no_verify,
- } => handle_squash(target.as_deref(), force, no_verify, false, false, true).map(|_| ()),
+ verify,
+ } => handle_squash(target.as_deref(), force, !verify, false, false, true).map(|_| ()),
StandaloneCommand::Push {
target,
allow_merge_commits,
@@ -220,13 +218,13 @@ fn main() {
base,
execute,
force,
- no_verify,
+ verify,
} => WorktrunkConfig::load()
.git_context("Failed to load config")
.and_then(|config| {
// Execute switch operation (creates worktree, runs post-create hooks)
let (result, resolved_branch) =
- handle_switch(&branch, create, base.as_deref(), force, no_verify, &config)?;
+ handle_switch(&branch, create, base.as_deref(), force, !verify, &config)?;
// Show success message (temporal locality: immediately after worktree creation)
handle_switch_output(&result, &resolved_branch, execute.is_some())?;
@@ -234,7 +232,7 @@ fn main() {
// Now spawn post-start hooks (background processes, after success message)
// Only run post-start commands when creating a NEW worktree, not when switching to existing
// Note: If user declines post-start commands, continue anyway - they're optional
- if !no_verify && let SwitchResult::Created { path, .. } = &result {
+ if verify && let SwitchResult::Created { path, .. } = &result {
let repo = Repository::current();
let repo_root = repo.worktree_base()?;
let ctx = CommandContext::new(
@@ -263,16 +261,15 @@ fn main() {
}),
Commands::Remove {
worktrees,
- no_delete_branch,
- no_background,
+ delete_branch,
+ background,
} => (|| -> Result<(), GitError> {
- let background = !no_background;
let repo = Repository::current();
if worktrees.is_empty() {
// No worktrees specified, remove current worktree
let current_branch = repo.resolve_worktree_name("@")?;
- let result = handle_remove(&current_branch, no_delete_branch, background)?;
+ let result = handle_remove(&current_branch, !delete_branch, background)?;
handle_remove_output(&result, None, false, background)
} else {
// When removing multiple worktrees, we need to handle the current worktree last
@@ -303,13 +300,13 @@ fn main() {
// Remove others first, then current last
// Progress messages shown by handle_remove_output for all cases
for resolved in &others {
- let result = handle_remove(resolved, no_delete_branch, background)?;
+ let result = handle_remove(resolved, !delete_branch, background)?;
handle_remove_output(&result, Some(resolved), false, background)?;
}
// Remove current worktree last (if it was in the list)
if let Some(resolved) = current {
- let result = handle_remove(&resolved, no_delete_branch, background)?;
+ let result = handle_remove(&resolved, !delete_branch, background)?;
handle_remove_output(&result, Some(&resolved), false, background)?;
}
@@ -318,18 +315,18 @@ fn main() {
})(),
Commands::Merge {
target,
- no_squash,
- no_commit,
- no_remove,
- no_verify,
+ squash,
+ commit,
+ remove,
+ verify,
force,
tracked_only,
} => handle_merge(
target.as_deref(),
- no_squash,
- no_commit,
- no_remove,
- no_verify,
+ !squash,
+ !commit,
+ !remove,
+ !verify,
force,
tracked_only,
),