Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refine exit code semantics for `-x` commands
Maximilian Roosbd8bba67b490
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex c97a5d3c2..390b6eb92 100644--- a/src/commands/worktree.rs+++ b/src/commands/worktree.rs@@ -85,15 +85,15 @@//!//! When using `-x` to execute commands after switching://!-//! - **Exit code returned**: The `wt` command's exit code-//! - **Command execution**: Runs for side effects; failures are logged but don't affect exit code-//! - **Rationale**: Allows scripts to detect `wt` failures (e.g., branch already exists) while-//! still executing post-switch commands for convenience+//! - **If wt operation fails**: Returns wt's exit code (command never executes)+//! - **If wt succeeds but command fails**: Returns the command's exit code+//! - **Rationale**: Enables command chaining with proper error propagation//!//! Example://! ```bash-//! wt switch --create feature -x "editor ." # Opens editor even if branch exists-//! echo $? # Returns wt's exit code, not editor's+//! wt switch feature -x "cargo build" && cargo test+//! # If wt fails (e.g., worktree doesn't exist), cargo build never runs+//! # If cargo build fails, cargo test doesn't run (exit code propagates)//! ```//!//! The shell wrapper is generated by `wt init <shell>` from templates in `templates/`.