Skip to content

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

feat: Use `ConfigAction::emoji()` for output consistency

Maximilian Roos2cccafef0735
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 7d83931b3..6a6c80b34 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -30,6 +30,15 @@ impl ConfigAction {
ConfigAction::WouldCreate => "Will create",
}
}
+
+ /// Returns the appropriate emoji for this action
+ pub fn emoji(&self) -> &'static str {
+ match self {
+ ConfigAction::Added | ConfigAction::Created => SUCCESS_EMOJI,
+ ConfigAction::AlreadyExists => INFO_EMOJI,
+ ConfigAction::WouldAdd | ConfigAction::WouldCreate => PROGRESS_EMOJI,
+ }
+ }
}
pub fn handle_configure_shell(
@@ -341,15 +350,9 @@ fn prompt_for_confirmation(results: &[ConfigureResult]) -> Result<bool, String>
let shell = result.shell;
let path = result.path.display();
- // Choose emoji based on action type (matches main.rs execution output)
- let emoji = match result.action {
- ConfigAction::Added | ConfigAction::Created => SUCCESS_EMOJI,
- ConfigAction::AlreadyExists => INFO_EMOJI,
- ConfigAction::WouldAdd | ConfigAction::WouldCreate => PROGRESS_EMOJI,
- };
-
eprintln!(
- "{emoji} {} {bold}{shell}{bold:#} {bold}{path}{bold:#}",
+ "{} {} {bold}{shell}{bold:#} {bold}{path}{bold:#}",
+ result.action.emoji(),
result.action.description(),
);
diff --git a/src/main.rs b/src/main.rs
index 82b106105..5914c1f22 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,7 @@ use std::sync::OnceLock;
use worktrunk::HookType;
use worktrunk::config::WorktrunkConfig;
use worktrunk::git::{GitError, GitResultExt, Repository};
-use worktrunk::styling::{INFO_EMOJI, PROGRESS_EMOJI, SUCCESS_EMOJI, println};
+use worktrunk::styling::{SUCCESS_EMOJI, println};
/// Get the version string, trying git describe first, falling back to Cargo version
fn version_str() -> &'static str {
@@ -549,15 +549,9 @@ fn main() {
let shell = result.shell;
let path = result.path.display();
- // Choose emoji based on action type
- let emoji = match result.action {
- ConfigAction::Added | ConfigAction::Created => SUCCESS_EMOJI,
- ConfigAction::AlreadyExists => INFO_EMOJI,
- ConfigAction::WouldAdd | ConfigAction::WouldCreate => PROGRESS_EMOJI,
- };
-
println!(
- "{emoji} {} {bold}{shell}{bold:#} {path}",
+ "{} {} {bold}{shell}{bold:#} {path}",
+ result.action.emoji(),
result.action.description(),
);
// Show config line with gutter