Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
refactor: Standardize switch success message wording
Maximilian Roosa98cfa0f539b
diff --git a/src/output/directive.rs b/src/output/directive.rsindex 64dead50e..675a304d7 100644--- a/src/output/directive.rs+++ b/src/output/directive.rs@@ -103,8 +103,8 @@ impl DirectiveOutput {/// Format a switch success message for directive mode///- /// In directive mode, the shell wrapper will actually change directories,- /// so we indicate the path with ": {path}"+ /// Directive mode mirrors the interactive wording ("at {path}") so the+ /// shell wrapper and direct CLI output stay consistent.pub fn format_switch_success(&self,branch: &str,@@ -112,7 +112,7 @@ impl DirectiveOutput {created_branch: bool,base_branch: Option<&str>,) -> String {- super::format_switch_success_message(branch, path, created_branch, base_branch, true)+ super::format_switch_success_message(branch, path, created_branch, base_branch)}}diff --git a/src/output/global.rs b/src/output/global.rsindex c28a27d21..b8ce77a7d 100644--- a/src/output/global.rs+++ b/src/output/global.rs@@ -179,10 +179,10 @@ pub fn terminate_output() -> io::Result<()> {})}-/// Format a switch success message (mode-specific)+/// Format a switch success message (identical across modes)///-/// In interactive mode: "at {path}" (can't actually change directory)-/// In directive mode: ": {path}" (shell will change it)+/// Both modes now report `"at {path}"` so users see the same wording whether+/// they invoke worktrunk directly or through the shell wrapper.pub fn format_switch_success(branch: &str,path: &Path,diff --git a/src/output/interactive.rs b/src/output/interactive.rsindex 68b14c3d3..9ce0bdfaf 100644--- a/src/output/interactive.rs+++ b/src/output/interactive.rs@@ -103,7 +103,7 @@ impl InteractiveOutput {created_branch: bool,base_branch: Option<&str>,) -> String {- super::format_switch_success_message(branch, path, created_branch, base_branch, false)+ super::format_switch_success_message(branch, path, created_branch, base_branch)}}diff --git a/src/output/mod.rs b/src/output/mod.rsindex 4c3df3cfa..c66f7c484 100644--- a/src/output/mod.rs+++ b/src/output/mod.rs@@ -74,17 +74,16 @@ pub use handlers::{use std::path::Path;-/// Format a switch success message with mode-specific location phrase+/// Format a switch success message with a consistent location phrase///-/// The message format differs between interactive and directive modes:-/// - Interactive: "Created new worktree for {branch} from {base} at {path}"-/// - Directive: "Created new worktree for {branch} from {base}: {path}"+/// Both interactive and directive modes now use the human-friendly+/// `"Created new worktree for {branch} from {base} at {path}"` wording so+/// users see the same message regardless of how worktrunk is invoked.pub(crate) fn format_switch_success_message(branch: &str,path: &Path,created_branch: bool,base_branch: Option<&str>,- use_past_tense: bool,) -> String {use worktrunk::styling::{GREEN, GREEN_BOLD};@@ -93,16 +92,15 @@ pub(crate) fn format_switch_success_message(} else {"Switched to worktree for"};- let location = if use_past_tense { ":" } else { " at" };// Re-establish GREEN after each green_bold reset to prevent color leakmatch base_branch {Some(base) => format!(- "{GREEN}{action} {GREEN_BOLD}{branch}{GREEN_BOLD:#}{GREEN} from {GREEN_BOLD}{base}{GREEN_BOLD:#}{GREEN}{location} {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",+ "{GREEN}{action} {GREEN_BOLD}{branch}{GREEN_BOLD:#}{GREEN} from {GREEN_BOLD}{base}{GREEN_BOLD:#}{GREEN} at {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",path.display()),None => format!(- "{GREEN}{action} {GREEN_BOLD}{branch}{GREEN_BOLD:#}{GREEN}{location} {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",+ "{GREEN}{action} {GREEN_BOLD}{branch}{GREEN_BOLD:#}{GREEN} at {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",path.display()),}diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snapindex 3d12ce5ad..d138e0fa6 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap@@ -2,4 +2,4 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mbash-test[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.bash-test[0m[0m+β [32mCreated new worktree for [1m[32mbash-test[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.bash-test[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snapindex 1bd3de242..5b94ebda1 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap@@ -2,7 +2,7 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mfish-multiline[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.fish-multiline[0m[0m+β [32mCreated new worktree for [1m[32mfish-multiline[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.fish-multiline[0m[0mπ [36mExecuting (--execute):[0m[40m [0m [1m[34mecho[0m [32m'line 1'[0m; [1m[34mecho[0m [32m'line 2'[0m; [1m[34mecho[0m [32m'line 3'[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snapindex 57540710b..565ace53c 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap@@ -2,4 +2,4 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mfish-minimal[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.fish-minimal[0m[0m+β [32mCreated new worktree for [1m[32mfish-minimal[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.fish-minimal[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snapindex 407d40927..fc1a6443a 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap@@ -2,6 +2,6 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mfish-bg[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.fish-bg[0m[0m+β [32mCreated new worktree for [1m[32mfish-bg[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.fish-bg[0m[0mπ [36mRunning post-start:[0m[40m [0m [1m[34mecho[0m [32m'fish background task'[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snapindex 548bc145f..85d7c9be6 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap@@ -2,4 +2,4 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mfeature[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.feature[0m[0m+β [32mCreated new worktree for [1m[32mfeature[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.feature[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snapindex 2b43a584f..668f0f036 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap@@ -2,7 +2,7 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mtest-exec[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.test-exec[0m[0m+β [32mCreated new worktree for [1m[32mtest-exec[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.test-exec[0m[0mπ [36mExecuting (--execute):[0m[40m [0m [1m[34mecho[0m executed[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snapindex 2b43a584f..668f0f036 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap@@ -2,7 +2,7 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mtest-exec[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.test-exec[0m[0m+β [32mCreated new worktree for [1m[32mtest-exec[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.test-exec[0m[0mπ [36mExecuting (--execute):[0m[40m [0m [1m[34mecho[0m executed[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snapindex 9b924f6b0..e1d3ae1e6 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap@@ -12,7 +12,7 @@ Building project...[40m [0m [1m[34mecho[0m [32m'Building project...'[0m[0m-β [32mCreated new worktree for [1m[32mfeature-hooks[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.feature-hooks[0m[0m+β [32mCreated new worktree for [1m[32mfeature-hooks[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.feature-hooks[0m[0mπ [36mRunning post-start: [1mserver[0m:[0m[40m [0m [1m[34mecho[0m [32m'Starting dev server on port 3000'[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snapindex 8f4592d12..105d7340a 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap@@ -2,6 +2,6 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mfeature-with-hooks[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.feature-with-hooks[0m[0m+β [32mCreated new worktree for [1m[32mfeature-with-hooks[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.feature-with-hooks[0m[0mπ [36mRunning post-start:[0m[40m [0m [1m[34mecho[0m [32m'test command executed'[0m[0mdiff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snapindex 7451e64ef..fee4602a9 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap@@ -2,6 +2,6 @@source: tests/integration_tests/shell_wrapper.rsexpression: output.normalized()----β [32mCreated new worktree for [1m[32mfeature-bg[0m[32m from [1m[32mmain[0m[32m: [1m[32m[TMPDIR]/test-repo.feature-bg[0m[0m+β [32mCreated new worktree for [1m[32mfeature-bg[0m[32m from [1m[32mmain[0m[32m at [1m[32m[TMPDIR]/test-repo.feature-bg[0m[0mπ [36mRunning post-start:[0m[40m [0m [1m[34mecho[0m [32m'background task'[0m[0mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snapindex 48dcbc859..440ac0853 100644Binary files a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap and b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap differdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snapindex 1f37cd7e2..855fc85d3 100644Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap differdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snapindex 3f2e263b9..598ff1cf8 100644Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap differ