Skip to content

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

Refactor switch success message for clarity

Maximilian Roosda278eb7fb3a
diff --git a/src/output/directive.rs b/src/output/directive.rs
index 3b5e3a630..e1acf3d99 100644
--- a/src/output/directive.rs
+++ b/src/output/directive.rs
@@ -86,7 +86,7 @@ impl DirectiveOutput {
/// Format a switch success message for directive mode
///
/// In directive mode, the shell wrapper will actually change directories,
- /// so we can say "changed directory to {path}"
+ /// so we indicate the path with ": {path}"
pub fn format_switch_success(
&self,
branch: &str,
diff --git a/src/output/global.rs b/src/output/global.rs
index 30d324991..cc461a6e1 100644
--- a/src/output/global.rs
+++ b/src/output/global.rs
@@ -140,7 +140,7 @@ pub fn terminate_output() -> io::Result<()> {
/// Format a switch success message (mode-specific)
///
/// In interactive mode: "at {path}" (can't actually change directory)
-/// In directive mode: "changed directory to {path}" (shell will change it)
+/// In directive mode: ": {path}" (shell will change it)
pub fn format_switch_success(
branch: &str,
path: &Path,
diff --git a/src/output/mod.rs b/src/output/mod.rs
index 6ca4ab171..baa159ac5 100644
--- a/src/output/mod.rs
+++ b/src/output/mod.rs
@@ -78,7 +78,7 @@ use std::path::Path;
///
/// 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}, changed directory to {path}"
+/// - Directive: "Created new worktree for {branch} from {base}: {path}"
pub(crate) fn format_switch_success_message(
branch: &str,
path: &Path,
@@ -97,11 +97,7 @@ pub(crate) fn format_switch_success_message(
let base_suffix = base_branch
.map(|b| format!(" from {green_bold}{b}{green_bold:#}{GREEN}"))
.unwrap_or_default();
- let location = if use_past_tense {
- ", changed directory to"
- } else {
- " at"
- };
+ let location = if use_past_tense { ":" } else { " at" };
format!(
"{SUCCESS_EMOJI} {GREEN}{action} {green_bold}{branch}{green_bold:#}{GREEN}{base_suffix}{location} {green_bold}{}{green_bold:#}{GREEN:#}",
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 16d705970..3d12ce5ad 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, changed directory to [TMPDIR]/test-repo.bash-test
+βœ… Created new worktree for bash-test from main: [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 87f07ac7a..1bd3de242 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, changed directory to [TMPDIR]/test-repo.fish-multiline
+βœ… Created new worktree for fish-multiline from main: [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 dfce837ea..57540710b 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, changed directory to [TMPDIR]/test-repo.fish-minimal
+βœ… Created new worktree for fish-minimal from main: [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 e253c3456..407d40927 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, changed directory to [TMPDIR]/test-repo.fish-bg
+βœ… Created new worktree for fish-bg from main: [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 2493b3fd9..548bc145f 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, changed directory to [TMPDIR]/test-repo.feature
+βœ… Created new worktree for feature from main: [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 434f431d8..2b43a584f 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, changed directory to [TMPDIR]/test-repo.test-exec
+βœ… Created new worktree for test-exec from main: [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 434f431d8..2b43a584f 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, changed directory to [TMPDIR]/test-repo.test-exec
+βœ… Created new worktree for test-exec from main: [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 96327de94..4e00306f0 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, changed directory to [TMPDIR]/test-repo.feature-hooks
+βœ… Created new worktree for feature-hooks from main: [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 9306f4729..8f4592d12 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, changed directory to [TMPDIR]/test-repo.feature-with-hooks
+βœ… Created new worktree for feature-with-hooks from main: [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 4089aad15..7451e64ef 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, changed directory to [TMPDIR]/test-repo.feature-bg
+βœ… Created new worktree for feature-bg from main: [TMPDIR]/test-repo.feature-bg
πŸ”„ Running post-start:
  echo 'background task'
diff --git a/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap b/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
index a61fa7542..b9f416587 100644
--- a/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
+++ b/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/e2e_shell.rs
expression: output
---
-βœ… Created new worktree for test-branch from main, changed directory to [REPO].test-branch
+βœ… Created new worktree for test-branch from main: [REPO].test-branch
MARKER
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 5e18f43e4..ce44c6279 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 8057d17a7..b72c9f082 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 4389ca9b5..6f852663a 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