Skip to content

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

fix(output): replace remaining quoted names with bold styling (#1380)

Maximilian Roosbcb61cbfd42b
diff --git a/src/git/error.rs b/src/git/error.rs
index 4044235a6..678dea39f 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -1226,10 +1226,10 @@ mod tests {
fn test_git_error_not_in_worktree() {
// With action
let err = GitError::NotInWorktree {
- action: Some("resolve '@'".into()),
+ action: Some("resolve @".into()),
};
let display = err.to_string();
- assert!(display.contains("Cannot resolve '@'"));
+ assert!(display.contains("Cannot resolve @"));
assert!(display.contains("not in a worktree"));
assert!(display.contains("specify a branch name"));
diff --git a/src/git/repository/worktrees.rs b/src/git/repository/worktrees.rs
index a5c32c206..29a29aa24 100644
--- a/src/git/repository/worktrees.rs
+++ b/src/git/repository/worktrees.rs
@@ -203,7 +203,7 @@ impl Repository {
match name {
"@" => self.current_worktree().branch()?.ok_or_else(|| {
GitError::DetachedHead {
- action: Some("resolve '@' to current branch".into()),
+ action: Some("resolve @ to current branch".into()),
}
.into()
}),
@@ -256,7 +256,7 @@ impl Repository {
.current_worktree()
.root()
.map_err(|_| GitError::NotInWorktree {
- action: Some("resolve '@'".into()),
+ action: Some("resolve @".into()),
})?;
// root() returns canonicalized path, so canonicalize worktree paths
// for comparison to handle symlinks (e.g., macOS /var -> /private/var)
diff --git a/src/llm.rs b/src/llm.rs
index 52035b77a..53e92a14d 100644
--- a/src/llm.rs
+++ b/src/llm.rs
@@ -1,4 +1,5 @@
use anyhow::Context;
+use color_print::cformat;
use shell_escape::escape;
use std::borrow::Cow;
use std::path::{Path, PathBuf};
@@ -376,8 +377,8 @@ fn load_template(
let expanded_path = PathBuf::from(shellexpand::tilde(path).as_ref());
std::fs::read_to_string(&expanded_path).map_err(|e| {
anyhow::Error::from(worktrunk::git::GitError::Other {
- message: format!(
- "Failed to read {} '{}': {}",
+ message: cformat!(
+ "Failed to read {} <bold>{}</>: {}",
file_type_name,
format_path_for_display(&expanded_path),
e
diff --git a/src/output/global.rs b/src/output/global.rs
index 0220069fc..670ea7cba 100644
--- a/src/output/global.rs
+++ b/src/output/global.rs
@@ -23,6 +23,9 @@ use std::io::{self, Write};
use std::os::unix::process::CommandExt;
use std::path::{Path, PathBuf};
use std::process::Stdio;
+
+#[cfg(unix)]
+use color_print::cformat;
use std::sync::{Mutex, OnceLock};
#[cfg(not(unix))]
@@ -312,12 +315,12 @@ fn execute_command(command: String, target_dir: Option<&Path>) -> anyhow::Result
.exec();
// exec() only returns on error
- Err(anyhow::anyhow!(
- "Failed to exec '{}' with {}: {}",
+ Err(anyhow::anyhow!(cformat!(
+ "Failed to exec <bold>{}</> with {}: {}",
command,
shell.name,
err
- ))
+ )))
}
/// Execute a command in the given directory (non-Unix: spawn and wait)