Skip to content

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.rs
index 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.rs
index 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.rs
index 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.rs
index 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 leak
match 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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for bash-test from main: [TMPDIR]/test-repo.bash-test
+βœ… Created new worktree for bash-test from main at [TMPDIR]/test-repo.bash-test
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for fish-multiline from main: [TMPDIR]/test-repo.fish-multiline
+βœ… Created new worktree for fish-multiline from main at [TMPDIR]/test-repo.fish-multiline
πŸ”„ Executing (--execute):
  echo 'line 1'; echo 'line 2'; echo 'line 3'
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for fish-minimal from main: [TMPDIR]/test-repo.fish-minimal
+βœ… Created new worktree for fish-minimal from main at [TMPDIR]/test-repo.fish-minimal
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for fish-bg from main: [TMPDIR]/test-repo.fish-bg
+βœ… Created new worktree for fish-bg from main at [TMPDIR]/test-repo.fish-bg
πŸ”„ Running post-start:
  echo 'fish background task'
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for feature from main: [TMPDIR]/test-repo.feature
+βœ… Created new worktree for feature from main at [TMPDIR]/test-repo.feature
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for test-exec from main: [TMPDIR]/test-repo.test-exec
+βœ… Created new worktree for test-exec from main at [TMPDIR]/test-repo.test-exec
πŸ”„ Executing (--execute):
  echo executed
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for test-exec from main: [TMPDIR]/test-repo.test-exec
+βœ… Created new worktree for test-exec from main at [TMPDIR]/test-repo.test-exec
πŸ”„ Executing (--execute):
  echo executed
diff --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.snap
index 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...
  echo 'Building project...'
-βœ… Created new worktree for feature-hooks from main: [TMPDIR]/test-repo.feature-hooks
+βœ… Created new worktree for feature-hooks from main at [TMPDIR]/test-repo.feature-hooks
πŸ”„ Running post-start: server:
  echo 'Starting dev server on port 3000'
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for feature-with-hooks from main: [TMPDIR]/test-repo.feature-with-hooks
+βœ… Created new worktree for feature-with-hooks from main at [TMPDIR]/test-repo.feature-with-hooks
πŸ”„ Running post-start:
  echo 'test command executed'
diff --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.snap
index 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.rs
expression: output.normalized()
---
-βœ… Created new worktree for feature-bg from main: [TMPDIR]/test-repo.feature-bg
+βœ… Created new worktree for feature-bg from main at [TMPDIR]/test-repo.feature-bg
πŸ”„ Running post-start:
  echo 'background task'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap
index 48dcbc859..440ac0853 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap and b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
index 1f37cd7e2..855fc85d3 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
index 3f2e263b9..598ff1cf8 100644
Binary 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