Skip to content

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

refactor: use anstream eprint consistently for TTY-aware output (#823)

Maximilian Roos020b790ce0fc
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 5ee639129..3fa16ec80 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -7,7 +7,7 @@ use anstyle::Style;
use worktrunk::path::format_path_for_display;
use worktrunk::shell::{self, Shell};
use worktrunk::styling::{
- INFO_SYMBOL, PROMPT_SYMBOL, SUCCESS_SYMBOL, eprintln, format_bash_with_gutter,
+ INFO_SYMBOL, PROMPT_SYMBOL, SUCCESS_SYMBOL, eprint, eprintln, format_bash_with_gutter,
format_with_gutter, warning_message,
};
@@ -750,8 +750,6 @@ pub fn prompt_for_install(
/// Prompt user for yes/no confirmation (simple [y/N] prompt)
fn prompt_yes_no() -> Result<bool, String> {
- use worktrunk::styling::eprint;
-
let bold = Style::new().bold();
eprint!("{PROMPT_SYMBOL} Proceed? {bold}[y/N]{bold:#} ");
io::stderr().flush().map_err(|e| e.to_string())?;
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
index 097e8d61a..6851dabd3 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_declined.snap
@@ -3,5 +3,5 @@ source: tests/integration_tests/configure_shell.rs
expression: "output.trim_start_matches('\\n')"
---
-❯ Install shell integration? [y/N/?]
+❯ Install shell integration? [y/N/?]
✗ Cancelled by user
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
index ced466a2c..0d6312c47 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
@@ -3,7 +3,7 @@ source: tests/integration_tests/configure_shell.rs
expression: "output.trim_start_matches('\\n')"
---
-❯ Install shell integration? [y/N/?]
+❯ Install shell integration? [y/N/?]
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped bash; ~/.bashrc not found
↳ Skipped fish; ~/.config/fish/functions not found