Skip to content

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

Rename _EMOJI constants to _SYMBOL

Maximilian Roosbc0502ff092d
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rs
index 02aee2d74..6de694a6e 100644
--- a/src/commands/command_approval.rs
+++ b/src/commands/command_approval.rs
@@ -25,7 +25,7 @@ use color_print::cformat;
use worktrunk::config::{Command, WorktrunkConfig};
use worktrunk::git::{GitError, HookType};
use worktrunk::styling::{
- INFO_EMOJI, PROMPT_EMOJI, WARNING_EMOJI, eprint, eprintln, format_bash_with_gutter,
+ INFO_SYMBOL, PROMPT_SYMBOL, WARNING_SYMBOL, eprint, eprintln, format_bash_with_gutter,
hint_message, stderr, warning_message,
};
@@ -109,7 +109,7 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> anyhow:
eprintln!(
"{}",
cformat!(
- "{WARNING_EMOJI} <yellow><bold>{project_name}</> needs approval to execute <bold>{count}</> command{plural}:</>"
+ "{WARNING_SYMBOL} <yellow><bold>{project_name}</> needs approval to execute <bold>{count}</> command{plural}:</>"
)
);
eprintln!();
@@ -120,8 +120,8 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> anyhow:
// Uses INFO_SYMBOL (○) since this is a preview, not active execution
let phase = cmd.phase.to_string();
let label = match &cmd.name {
- Some(name) => cformat!("{INFO_EMOJI} {phase} <bold>{name}</>:"),
- None => format!("{INFO_EMOJI} {phase}:"),
+ Some(name) => cformat!("{INFO_SYMBOL} {phase} <bold>{name}</>:"),
+ None => format!("{INFO_SYMBOL} {phase}:"),
};
eprintln!("{label}");
eprint!("{}", format_bash_with_gutter(&cmd.template, ""));
@@ -139,7 +139,7 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> anyhow:
eprint!(
"{}",
- cformat!("{PROMPT_EMOJI} Allow and remember? <bold>[y/N]</> ")
+ cformat!("{PROMPT_SYMBOL} Allow and remember? <bold>[y/N]</> ")
);
stderr().flush()?;
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 1112fa832..0d4cdc35c 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -5,7 +5,7 @@ use worktrunk::path::format_path_for_display;
use worktrunk::shell::{self, Shell};
use worktrunk::shell_exec::ShellConfig;
use worktrunk::styling::{
- INFO_EMOJI, PROGRESS_EMOJI, PROMPT_EMOJI, SUCCESS_EMOJI, format_bash_with_gutter,
+ INFO_SYMBOL, PROGRESS_SYMBOL, PROMPT_SYMBOL, SUCCESS_SYMBOL, format_bash_with_gutter,
format_with_gutter, hint_message, warning_message,
};
@@ -63,10 +63,10 @@ impl UninstallAction {
}
}
- pub fn emoji(&self) -> &'static str {
+ pub fn symbol(&self) -> &'static str {
match self {
- UninstallAction::Removed => SUCCESS_EMOJI,
- UninstallAction::WouldRemove => PROGRESS_EMOJI,
+ UninstallAction::Removed => SUCCESS_SYMBOL,
+ UninstallAction::WouldRemove => PROGRESS_SYMBOL,
}
}
}
@@ -91,12 +91,12 @@ impl ConfigAction {
}
}
- /// Returns the appropriate emoji for this action
- pub fn emoji(&self) -> &'static str {
+ /// Returns the appropriate symbol for this action
+ pub fn symbol(&self) -> &'static str {
match self {
- ConfigAction::Added | ConfigAction::Created => SUCCESS_EMOJI,
- ConfigAction::AlreadyExists => INFO_EMOJI,
- ConfigAction::WouldAdd | ConfigAction::WouldCreate => PROGRESS_EMOJI,
+ ConfigAction::Added | ConfigAction::Created => SUCCESS_SYMBOL,
+ ConfigAction::AlreadyExists => INFO_SYMBOL,
+ ConfigAction::WouldAdd | ConfigAction::WouldCreate => PROGRESS_SYMBOL,
}
}
}
@@ -530,7 +530,7 @@ fn prompt_for_confirmation(
eprintln!(
"{} {} {what} for {bold}{shell}{bold:#} @ {bold}{path}{bold:#}",
- result.action.emoji(),
+ result.action.symbol(),
result.action.description(),
);
@@ -550,7 +550,7 @@ fn prompt_for_confirmation(
eprintln!(
"{} {} completions for {bold}{shell}{bold:#} @ {bold}{path}{bold:#}",
- result.action.emoji(),
+ result.action.symbol(),
result.action.description(),
);
@@ -567,10 +567,10 @@ fn prompt_for_confirmation(
fn prompt_yes_no() -> Result<bool, String> {
use anstyle::Style;
use std::io::Write;
- use worktrunk::styling::{PROMPT_EMOJI, eprint, eprintln};
+ use worktrunk::styling::{PROMPT_SYMBOL, eprint, eprintln};
let bold = Style::new().bold();
- eprint!("{PROMPT_EMOJI} Proceed? {bold}[y/N]{bold:#} ");
+ eprint!("{PROMPT_SYMBOL} Proceed? {bold}[y/N]{bold:#} ");
io::stderr().flush().map_err(|e| e.to_string())?;
let mut input = String::new();
@@ -885,7 +885,7 @@ fn prompt_for_uninstall_confirmation(
eprintln!(
"{} {} {what} for {bold}{shell}{bold:#} @ {bold}{path}{bold:#}",
- result.action.emoji(),
+ result.action.symbol(),
result.action.description(),
);
}
@@ -897,7 +897,7 @@ fn prompt_for_uninstall_confirmation(
eprintln!(
"{} {} completions for {bold}{shell}{bold:#} @ {bold}{path}{bold:#}",
- result.action.emoji(),
+ result.action.symbol(),
result.action.description(),
);
}
@@ -971,7 +971,7 @@ pub fn handle_show_theme() -> Result<(), String> {
// Prompt
crate::output::print(info_message("Prompt formatting:")).map_err(|e| e.to_string())?;
- crate::output::print(format!("{PROMPT_EMOJI} Proceed? [y/N] ")).map_err(|e| e.to_string())?;
+ crate::output::print(format!("{PROMPT_SYMBOL} Proceed? [y/N] ")).map_err(|e| e.to_string())?;
Ok(())
}
@@ -988,8 +988,8 @@ mod tests {
#[test]
fn test_uninstall_action_emoji() {
- assert_eq!(UninstallAction::Removed.emoji(), SUCCESS_EMOJI);
- assert_eq!(UninstallAction::WouldRemove.emoji(), PROGRESS_EMOJI);
+ assert_eq!(UninstallAction::Removed.symbol(), SUCCESS_SYMBOL);
+ assert_eq!(UninstallAction::WouldRemove.symbol(), PROGRESS_SYMBOL);
}
#[test]
@@ -1006,11 +1006,11 @@ mod tests {
#[test]
fn test_config_action_emoji() {
- assert_eq!(ConfigAction::Added.emoji(), SUCCESS_EMOJI);
- assert_eq!(ConfigAction::Created.emoji(), SUCCESS_EMOJI);
- assert_eq!(ConfigAction::AlreadyExists.emoji(), INFO_EMOJI);
- assert_eq!(ConfigAction::WouldAdd.emoji(), PROGRESS_EMOJI);
- assert_eq!(ConfigAction::WouldCreate.emoji(), PROGRESS_EMOJI);
+ assert_eq!(ConfigAction::Added.symbol(), SUCCESS_SYMBOL);
+ assert_eq!(ConfigAction::Created.symbol(), SUCCESS_SYMBOL);
+ assert_eq!(ConfigAction::AlreadyExists.symbol(), INFO_SYMBOL);
+ assert_eq!(ConfigAction::WouldAdd.symbol(), PROGRESS_SYMBOL);
+ assert_eq!(ConfigAction::WouldCreate.symbol(), PROGRESS_SYMBOL);
}
#[test]
diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rs
index 3ee189009..a29d8391a 100644
--- a/src/commands/list/collect.rs
+++ b/src/commands/list/collect.rs
@@ -25,7 +25,7 @@ use crossbeam_channel as chan;
use dunce::canonicalize;
use rayon::prelude::*;
use worktrunk::git::{LineDiff, Repository, Worktree};
-use worktrunk::styling::{INFO_EMOJI, format_with_gutter, warning_message};
+use worktrunk::styling::{INFO_SYMBOL, format_with_gutter, warning_message};
use crate::commands::is_worktree_at_expected_path;
@@ -750,7 +750,7 @@ pub fn collect(
.map(|item| layout.format_skeleton_row(item))
.collect();
- let initial_footer = format!("{INFO_EMOJI} {dim}{footer_base} (loading...){dim:#}");
+ let initial_footer = format!("{INFO_SYMBOL} {dim}{footer_base} (loading...){dim:#}");
let table = ProgressiveTable::new(
layout.format_header_line(),
@@ -896,7 +896,7 @@ pub fn collect(
// Update footer progress
let footer_msg = format!(
- "{INFO_EMOJI} {dim}{footer_base} ({completed_results}/{total_results} loaded){dim:#}"
+ "{INFO_SYMBOL} {dim}{footer_base} ({completed_results}/{total_results} loaded){dim:#}"
);
if let Err(e) = table.update_footer(footer_msg) {
log::debug!("Progressive footer update failed: {}", e);
diff --git a/src/commands/list/mod.rs b/src/commands/list/mod.rs
index 67e9a72e6..1ea3bc0da 100644
--- a/src/commands/list/mod.rs
+++ b/src/commands/list/mod.rs
@@ -368,14 +368,14 @@ pub(crate) fn format_summary_message(
hidden_column_count: usize,
) -> String {
use anstyle::Style;
- use worktrunk::styling::INFO_EMOJI;
+ use worktrunk::styling::INFO_SYMBOL;
let metrics = SummaryMetrics::from_items(items);
let dim = Style::new().dimmed();
let summary = metrics
.summary_parts(show_branches, hidden_column_count)
.join(", ");
- format!("{INFO_EMOJI} {dim}Showing {summary}{dim:#}")
+ format!("{INFO_SYMBOL} {dim}Showing {summary}{dim:#}")
}
#[cfg(test)]
diff --git a/src/commands/select.rs b/src/commands/select.rs
index d891809ed..edaab3b9b 100644
--- a/src/commands/select.rs
+++ b/src/commands/select.rs
@@ -474,13 +474,13 @@ impl WorktreeSkimItem {
/// Render Tab 1: Working tree preview (uncommitted changes vs HEAD)
/// Matches `wt list` "HEAD±" column
fn render_working_tree_preview(&self, width: usize) -> String {
- use worktrunk::styling::INFO_EMOJI;
+ use worktrunk::styling::INFO_SYMBOL;
let Some(wt_info) = self.item.worktree_data() else {
// Branch without worktree - selecting will create one
let branch = self.item.branch_name();
return format!(
- "{INFO_EMOJI} {branch} is branch only — press Enter to create worktree\n"
+ "{INFO_SYMBOL} {branch} is branch only — press Enter to create worktree\n"
);
};
@@ -488,7 +488,7 @@ impl WorktreeSkimItem {
let path = wt_info.path.display().to_string();
self.render_diff_preview(
&["-C", &path, "diff", "HEAD"],
- &cformat!("{INFO_EMOJI} <bold>{branch}</> has no uncommitted changes"),
+ &cformat!("{INFO_SYMBOL} <bold>{branch}</> has no uncommitted changes"),
width,
)
}
@@ -496,30 +496,32 @@ impl WorktreeSkimItem {
/// Render Tab 3: Branch diff preview (line diffs in commits ahead of default branch)
/// Matches `wt list` "main…± (--full)" column
fn render_branch_diff_preview(&self, width: usize) -> String {
- use worktrunk::styling::INFO_EMOJI;
+ use worktrunk::styling::INFO_SYMBOL;
let branch = self.item.branch_name();
let repo = Repository::current();
let Ok(default_branch) = repo.default_branch() else {
- return cformat!("{INFO_EMOJI} <bold>{branch}</> has no commits ahead of main\n");
+ return cformat!("{INFO_SYMBOL} <bold>{branch}</> has no commits ahead of main\n");
};
if self.item.counts().ahead == 0 {
return cformat!(
- "{INFO_EMOJI} <bold>{branch}</> has no commits ahead of <bold>{default_branch}</>\n"
+ "{INFO_SYMBOL} <bold>{branch}</> has no commits ahead of <bold>{default_branch}</>\n"
);
}
let merge_base = format!("{}...{}", default_branch, self.item.head());
self.render_diff_preview(
&["diff", &merge_base],
- &cformat!("{INFO_EMOJI} <bold>{branch}</> has no changes vs <bold>{default_branch}</>"),
+ &cformat!(
+ "{INFO_SYMBOL} <bold>{branch}</> has no changes vs <bold>{default_branch}</>"
+ ),
width,
)
}
/// Render Tab 2: Log preview
fn render_log_preview(&self, width: usize, height: usize) -> String {
- use worktrunk::styling::INFO_EMOJI;
+ use worktrunk::styling::INFO_SYMBOL;
// Minimum preview width to show timestamps (adds ~7 chars: space + 4-char time + space)
// Note: preview is typically 50% of terminal width, so 50 = 100-col terminal
const TIMESTAMP_WIDTH_THRESHOLD: usize = 50;
@@ -534,7 +536,9 @@ impl WorktreeSkimItem {
let head = self.item.head();
let branch = self.item.branch_name();
let Ok(default_branch) = repo.default_branch() else {
- output.push_str(&cformat!("{INFO_EMOJI} <bold>{branch}</> has no commits\n"));
+ output.push_str(&cformat!(
+ "{INFO_SYMBOL} <bold>{branch}</> has no commits\n"
+ ));
return output;
};
@@ -549,7 +553,9 @@ impl WorktreeSkimItem {
// running git commands. This would provide better diagnostics but adds latency to
// every preview render. Trade-off: simplicity + speed vs. detailed error messages.
let Ok(merge_base_output) = repo.run_command(&["merge-base", &default_branch, head]) else {
- output.push_str(&cformat!("{INFO_EMOJI} <bold>{branch}</> has no commits\n"));
+ output.push_str(&cformat!(
+ "{INFO_SYMBOL} <bold>{branch}</> has no commits\n"
+ ));
return output;
};
diff --git a/src/commands/standalone.rs b/src/commands/standalone.rs
index 38482812a..af69e220b 100644
--- a/src/commands/standalone.rs
+++ b/src/commands/standalone.rs
@@ -6,7 +6,7 @@ use worktrunk::config::{CommandConfig, ProjectConfig, WorktrunkConfig};
use worktrunk::git::Repository;
use worktrunk::path::format_path_for_display;
use worktrunk::styling::{
- INFO_EMOJI, PROMPT_EMOJI, format_bash_with_gutter, format_heading, format_with_gutter,
+ INFO_SYMBOL, PROMPT_SYMBOL, format_bash_with_gutter, format_heading, format_with_gutter,
hint_message, info_message, progress_message, success_message,
};
@@ -846,9 +846,9 @@ fn render_hook_commands(
// Use ❯ for needs approval, ○ for approved/user hooks
let (emoji, suffix) = if needs_approval {
- (PROMPT_EMOJI, cformat!(" <dim>(requires approval)</>"))
+ (PROMPT_SYMBOL, cformat!(" <dim>(requires approval)</>"))
} else {
- (INFO_EMOJI, String::new())
+ (INFO_SYMBOL, String::new())
};
writeln!(out, "{emoji} {label}{suffix}")?;
diff --git a/src/git/error.rs b/src/git/error.rs
index f9c421842..1e54b37b8 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -18,7 +18,7 @@ use shell_escape::escape;
use super::HookType;
use crate::path::format_path_for_display;
use crate::styling::{
- ERROR_EMOJI, HINT_EMOJI, error_message, format_bash_with_gutter, format_with_gutter,
+ ERROR_SYMBOL, HINT_SYMBOL, error_message, format_bash_with_gutter, format_with_gutter,
hint_message, info_message, suggest_command,
};
@@ -223,7 +223,7 @@ impl std::fmt::Display for GitError {
let cmd = suggest_command("switch", &[branch], &[]);
cwrite!(
f,
- "{ERROR_EMOJI} <red>Branch <bold>{branch}</> exists only on remote ({remote}/{branch})</>\n\n{HINT_EMOJI} <dim>To create a local worktree, run <bright-black>{cmd}</></>"
+ "{ERROR_SYMBOL} <red>Branch <bold>{branch}</> exists only on remote ({remote}/{branch})</>\n\n{HINT_SYMBOL} <dim>To create a local worktree, run <bright-black>{cmd}</></>"
)
}
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 38b58909e..3ca0468a4 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -15,7 +15,7 @@ use worktrunk::git::path_dir_name;
use worktrunk::path::format_path_for_display;
use worktrunk::shell::Shell;
use worktrunk::styling::{
- FormattedMessage, PROGRESS_EMOJI, SUCCESS_EMOJI, error_message, format_with_gutter,
+ FormattedMessage, PROGRESS_SYMBOL, SUCCESS_SYMBOL, error_message, format_with_gutter,
hint_message, info_message, progress_message, success_message, suggest_command,
warning_message,
};
@@ -331,19 +331,19 @@ fn format_remove_worktree_message(
let msg = if changed_directory {
if let Some(b) = branch_display {
cformat!(
- "{SUCCESS_EMOJI} <green>Removed <bold>{b}</> {action_suffix}; changed directory to <bold>{path_display}</>{flag_text}</>{flag_after}"
+ "{SUCCESS_SYMBOL} <green>Removed <bold>{b}</> {action_suffix}; changed directory to <bold>{path_display}</>{flag_text}</>{flag_after}"
)
} else {
cformat!(
- "{SUCCESS_EMOJI} <green>Removed {action_suffix}; changed directory to <bold>{path_display}</>{flag_text}</>{flag_after}"
+ "{SUCCESS_SYMBOL} <green>Removed {action_suffix}; changed directory to <bold>{path_display}</>{flag_text}</>{flag_after}"
)
}
} else if let Some(b) = branch_display {
cformat!(
- "{SUCCESS_EMOJI} <green>Removed <bold>{b}</> {action_suffix}{flag_text}</>{flag_after}"
+ "{SUCCESS_SYMBOL} <green>Removed <bold>{b}</> {action_suffix}{flag_text}</>{flag_after}"
)
} else {
- cformat!("{SUCCESS_EMOJI} <green>Removed {action_suffix}{flag_text}</>{flag_after}")
+ cformat!("{SUCCESS_SYMBOL} <green>Removed {action_suffix}{flag_text}</>{flag_after}")
};
FormattedMessage::new(msg)
}
@@ -562,7 +562,7 @@ fn handle_branch_only_output(
let flag_text = &flag_note.text;
let flag_after = flag_note.after_green();
super::print(FormattedMessage::new(cformat!(
- "{SUCCESS_EMOJI} <green>Removed branch <bold>{branch_name}</>{flag_text}</>{flag_after}"
+ "{SUCCESS_SYMBOL} <green>Removed branch <bold>{branch_name}</>{flag_text}</>{flag_after}"
)))?;
}
@@ -682,15 +682,15 @@ fn handle_removed_worktree_output(
// in its canonical dim styling, not tinted by cyan.
let action = if deletion_mode.should_keep() {
cformat!(
- "{PROGRESS_EMOJI} <cyan>Removing <bold>{branch_name}</> worktree in background; retaining branch{flag_text}</>{flag_after}"
+ "{PROGRESS_SYMBOL} <cyan>Removing <bold>{branch_name}</> worktree in background; retaining branch{flag_text}</>{flag_after}"
)
} else if should_delete_branch {
cformat!(
- "{PROGRESS_EMOJI} <cyan>Removing <bold>{branch_name}</> worktree & branch in background{flag_text}</>{flag_after}"
+ "{PROGRESS_SYMBOL} <cyan>Removing <bold>{branch_name}</> worktree & branch in background{flag_text}</>{flag_after}"
)
} else {
cformat!(
- "{PROGRESS_EMOJI} <cyan>Removing <bold>{branch_name}</> worktree in background; retaining unmerged branch</>"
+ "{PROGRESS_SYMBOL} <cyan>Removing <bold>{branch_name}</> worktree in background; retaining unmerged branch</>"
)
};
super::print(FormattedMessage::new(action))?;
diff --git a/src/styling/constants.rs b/src/styling/constants.rs
index 80e09c679..660f3176f 100644
--- a/src/styling/constants.rs
+++ b/src/styling/constants.rs
@@ -84,22 +84,6 @@ pub const INFO_SYMBOL: &str = cstr!("<dim>○</>");
/// Prompt symbol (cyan ❯) - for questions requiring user input
pub const PROMPT_SYMBOL: &str = cstr!("<cyan>❯</>");
-// Legacy aliases for compatibility during migration
-#[doc(hidden)]
-pub use ERROR_SYMBOL as ERROR_EMOJI;
-#[doc(hidden)]
-pub use HINT_SYMBOL as HINT_EMOJI;
-#[doc(hidden)]
-pub use INFO_SYMBOL as INFO_EMOJI;
-#[doc(hidden)]
-pub use PROGRESS_SYMBOL as PROGRESS_EMOJI;
-#[doc(hidden)]
-pub use PROMPT_SYMBOL as PROMPT_EMOJI;
-#[doc(hidden)]
-pub use SUCCESS_SYMBOL as SUCCESS_EMOJI;
-#[doc(hidden)]
-pub use WARNING_SYMBOL as WARNING_EMOJI;
-
// ============================================================================
// Formatted Message Type
// ============================================================================
diff --git a/tests/integration_tests/completion_validation.rs b/tests/integration_tests/completion_validation.rs
index 6e1c22712..d5445e602 100644
--- a/tests/integration_tests/completion_validation.rs
+++ b/tests/integration_tests/completion_validation.rs
@@ -1,6 +1,6 @@
use crate::common::wt_command;
use std::collections::HashSet;
-use worktrunk::styling::SUCCESS_EMOJI;
+use worktrunk::styling::SUCCESS_SYMBOL;
/// Issue found during validation
#[derive(Debug)]
@@ -326,6 +326,6 @@ fn test_completion_validation() {
}
if errors.is_empty() && warnings.is_empty() {
- println!("{SUCCESS_EMOJI} All shell completions validated successfully!");
+ println!("{SUCCESS_SYMBOL} All shell completions validated successfully!");
}
}