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.rsindex 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>) -> anyhowlet 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.rsindex 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.rsindex 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 errorpub 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.rsindex 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), @"β [32mSet status for [1m[32mmain[0m to [1m[32mπ§[0m[0m");+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"β [32mSet status for [1m[32mmain[0m[32m to [1m[32mπ§[0m[0m");// Verify it was setlet 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), @"β [32mSet status for [1m[32mfeature[0m to [1m[32mπ§[0m[0m");+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"β [32mSet status for [1m[32mfeature[0m[32m to [1m[32mπ§[0m[0m");// Verify it was setlet 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), @"β [32mCleared [1m[32m3[0m statuses[0m");+ assert_snapshot!(String::from_utf8_lossy(&output.stdout), @"β [32mCleared [1m[32m3[0m[32m statuses[0m");// Verify all were unsetlet output = repodiff --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.snapindex 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()π [36mRunning pre-merge [1mtest[0m:[0m[107m [0m [1m[34mecho[0m [32m'β Test suite failed: 3 tests failing'[0m [36m&&[0m [1m[34mexit[0m 1[0mβ Test suite failed: 3 tests failing-β [31mpre-merge command failed: [1m[31mtest[0m: exit status: 1[0m+β [31mpre-merge command failed: [1m[31mtest[0m[31m: exit status: 1[0mπ‘ [2mUse --no-verify to skip pre-merge commands[0mdiff --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.snapindex 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()π [36mRunning pre-merge [1mtest[0m:[0m[107m [0m [1m[34mecho[0m [32m'β Test suite failed: 3 tests failing'[0m [36m&&[0m [1m[34mexit[0m 1[0mβ Test suite failed: 3 tests failing-β [31mpre-merge command failed: [1m[31mtest[0m: exit status: 1[0m+β [31mpre-merge command failed: [1m[31mtest[0m[31m: exit status: 1[0mπ‘ [2mUse --no-verify to skip pre-merge commands[0mdiff --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.snapindex 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/nullGIT_EDITOR: ""LANG: C@@ -22,7 +22,7 @@ info:success: falseexit_code: 1----- stdout ------β [31mCan't push to local [1m[31mmain[0m branch: it has newer commits[0m+β [31mCan't push to local [1m[31mmain[0m[31m branch: it has newer commits[0m* [SHA][33m ([m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m, [m[1;32mmain[m[33m)[m Main commitmain-file.txt | 1 [32m+[mdiff --git a/tests/snapshots/integration__integration_tests__remove__remove_foreground.snap b/tests/snapshots/integration__integration_tests__remove__remove_foreground.snapindex 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/nullGIT_EDITOR: ""LANG: C@@ -22,7 +22,7 @@ info:success: trueexit_code: 0----- stdout ------π [36mRemoving worktree for [1m[36mfeature-fg[0m...[0m+π [36mRemoving worktree for [1m[36mfeature-fg[0m[36m...[0mβ [32mRemoved worktree & branch for [1m[32mfeature-fg[0m[0m----- stderr -----