Skip to content

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

Improve color consistency in output messages

Maximilian Roosdf99f8df009e
diff --git a/src/commands/config.rs b/src/commands/config.rs
index ed216d703..98b7822bd 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -203,7 +203,7 @@ pub fn handle_config_status_set(value: String, branch: Option<String>) -> anyhow
let branch_bold = GREEN.bold();
crate::output::success(format!(
- "{GREEN}Set status for {branch_bold}{branch_name}{branch_bold:#} to {GREEN_BOLD}{value}{GREEN_BOLD:#}{GREEN:#}"
+ "{GREEN}Set status for {branch_bold}{branch_name}{branch_bold:#}{GREEN} to {GREEN_BOLD}{value}{GREEN_BOLD:#}{GREEN:#}"
))?;
Ok(())
@@ -231,7 +231,7 @@ pub fn handle_config_status_unset(target: String) -> anyhow::Result<()> {
crate::output::info("No statuses to clear")?;
} else {
crate::output::success(format!(
- "{GREEN}Cleared {GREEN_BOLD}{cleared_count}{GREEN_BOLD:#} status{}{GREEN:#}",
+ "{GREEN}Cleared {GREEN_BOLD}{cleared_count}{GREEN_BOLD:#}{GREEN} status{}{GREEN:#}",
if cleared_count == 1 { "" } else { "es" }
))?;
}
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 1c9cc2ce1..43df2c425 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -384,7 +384,7 @@ pub fn handle_remove(
// Show progress (unless running in background - output handler will show command)
if !background {
let progress_msg = format!(
- "{CYAN}Removing worktree for {CYAN_BOLD}{worktree_name}{CYAN_BOLD:#}...{CYAN:#}"
+ "{CYAN}Removing worktree for {CYAN_BOLD}{worktree_name}{CYAN_BOLD:#}{CYAN}...{CYAN:#}"
);
crate::output::progress(progress_msg)?;
}
diff --git a/src/git/error.rs b/src/git/error.rs
index 29da071f7..a8fc06496 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -7,7 +7,9 @@ use std::path::Path;
use super::HookType;
use crate::path::format_path_for_display;
-use crate::styling::{ERROR, ERROR_BOLD, ERROR_EMOJI, HINT, HINT_EMOJI, format_with_gutter};
+use crate::styling::{
+ ERROR, ERROR_BOLD, ERROR_EMOJI, HINT, HINT_BOLD, HINT_EMOJI, format_with_gutter,
+};
/// Semantic errors that require special handling in main.rs
///
@@ -42,7 +44,7 @@ impl std::fmt::Display for WorktrunkError {
} => {
let name_suffix = command_name
.as_ref()
- .map(|n| format!(": {ERROR_BOLD}{n}{ERROR_BOLD:#}"))
+ .map(|n| format!(": {ERROR_BOLD}{n}{ERROR_BOLD:#}{ERROR}"))
.unwrap_or_default();
write!(
@@ -136,7 +138,7 @@ pub fn no_worktree_found(branch: &str) -> anyhow::Error {
/// Worktree path occupied error
pub fn worktree_path_occupied(branch: &str, path: &Path, occupant: Option<&str>) -> anyhow::Error {
let occupant_note = occupant
- .map(|b| format!(" (currently on {ERROR_BOLD}{b}{ERROR_BOLD:#})"))
+ .map(|b| format!(" (currently on {HINT_BOLD}{b}{HINT_BOLD:#}{HINT})"))
.unwrap_or_default();
anyhow::anyhow!(
"{ERROR_EMOJI} {ERROR}Cannot create worktree for {ERROR_BOLD}{branch}{ERROR_BOLD:#}{ERROR}: target path already exists{ERROR:#}\n\n{HINT_EMOJI} {HINT}Reuse the existing worktree at {}{} or remove it before retrying{HINT:#}",
@@ -168,7 +170,7 @@ pub fn not_fast_forward(
files_formatted: &str,
) -> anyhow::Error {
let mut msg = format!(
- "{ERROR_EMOJI} {ERROR}Can't push to local {ERROR_BOLD}{target_branch}{ERROR_BOLD:#} branch: it has newer commits{ERROR:#}\n"
+ "{ERROR_EMOJI} {ERROR}Can't push to local {ERROR_BOLD}{target_branch}{ERROR_BOLD:#}{ERROR} branch: it has newer commits{ERROR:#}\n"
);
if !commits_formatted.is_empty() {
@@ -240,7 +242,7 @@ pub fn worktree_creation_failed(
error: &str,
) -> anyhow::Error {
let base_suffix = base_branch
- .map(|base| format!("{ERROR} from base {ERROR_BOLD}{base}{ERROR_BOLD:#}"))
+ .map(|base| format!("{ERROR} from base {ERROR_BOLD}{base}{ERROR_BOLD:#}{ERROR}"))
.unwrap_or_default();
let header = format!(
diff --git a/tests/integration_tests/config_status.rs b/tests/integration_tests/config_status.rs
index 41adbccac..42551c65c 100644
--- a/tests/integration_tests/config_status.rs
+++ b/tests/integration_tests/config_status.rs
@@ -20,7 +20,7 @@ fn test_config_status_set_branch_default() {
.output()
.unwrap();
assert!(output.status.success());
- assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"βœ… Set status for main to 🚧");
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"βœ… Set status for main to 🚧");
// Verify it was set
let output = repo
@@ -40,7 +40,7 @@ fn test_config_status_set_branch_specific() {
.output()
.unwrap();
assert!(output.status.success());
- assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"βœ… Set status for feature to πŸ”§");
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"βœ… Set status for feature to πŸ”§");
// Verify it was set
let output = repo
@@ -116,7 +116,7 @@ fn test_config_status_unset_all() {
.output()
.unwrap();
assert!(output.status.success());
- assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"βœ… Cleared 3 statuses");
+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"βœ… Cleared 3 statuses");
// Verify all were unset
let output = repo
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
index 307539adb..12840d713 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
@@ -8,6 +8,6 @@ expression: output.normalized()
πŸ”„ Running pre-merge test:
  echo 'βœ— Test suite failed: 3 tests failing' && exit 1
βœ— Test suite failed: 3 tests failing
-❌ pre-merge command failed: test: exit status: 1
+❌ pre-merge command failed: test: exit status: 1
πŸ’‘ Use --no-verify to skip pre-merge commands
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
index 307539adb..12840d713 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
@@ -8,6 +8,6 @@ expression: output.normalized()
πŸ”„ Running pre-merge test:
  echo 'βœ— Test suite failed: 3 tests failing' && exit 1
βœ— Test suite failed: 3 tests failing
-❌ pre-merge command failed: test: exit status: 1
+❌ pre-merge command failed: test: exit status: 1
πŸ’‘ Use --no-verify to skip pre-merge commands
diff --git a/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap
index 6c12247eb..ee72f0a38 100644
--- a/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap
@@ -11,7 +11,7 @@ info:
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
LANG: C
@@ -22,7 +22,7 @@ info:
success: false
exit_code: 1
----- stdout -----
-❌ Can't push to local main branch: it has newer commits
+❌ Can't push to local main branch: it has newer commits
* [SHA] (origin/main, origin/HEAD, main) Main commit
main-file.txt | 1 +
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_foreground.snap b/tests/snapshots/integration__integration_tests__remove__remove_foreground.snap
index 248a7c6a2..d7f1cce73 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_foreground.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_foreground.snap
@@ -11,7 +11,7 @@ info:
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
LANG: C
@@ -22,7 +22,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-πŸ”„ Removing worktree for feature-fg...
+πŸ”„ Removing worktree for feature-fg...
βœ… Removed worktree & branch for feature-fg
----- stderr -----