Skip to content

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

Use SUCCESS_EMOJI constant for success messages

Maximilian Roosa1de883f538d
diff --git a/src/commands/config.rs b/src/commands/config.rs
index b7ecd98b7..f35b2c01a 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -1,7 +1,9 @@
use etcetera::base_strategy::{BaseStrategy, choose_base_strategy};
use std::path::PathBuf;
use worktrunk::git::{GitError, Repository};
-use worktrunk::styling::{AnstyleStyle, GREEN, HINT, HINT_EMOJI, format_toml, print, println};
+use worktrunk::styling::{
+ AnstyleStyle, GREEN, HINT, HINT_EMOJI, SUCCESS_EMOJI, format_toml, print, println,
+};
/// Example configuration file content
const CONFIG_EXAMPLE: &str = include_str!("../../config.example.toml");
@@ -37,7 +39,7 @@ pub fn handle_config_init() -> Result<(), GitError> {
// Success message
let bold = AnstyleStyle::new().bold();
- println!("βœ… {GREEN}Created config file{GREEN:#}");
+ println!("{SUCCESS_EMOJI} {GREEN}Created config file{GREEN:#}");
println!(" {bold}{}{bold:#}", config_path.display());
println!();
println!(
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index b29ffd104..3403d3c51 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -341,7 +341,7 @@ fn prompt_for_confirmation(results: &[ConfigureResult]) -> Result<bool, String>
let cyan_bold = cyan.bold();
eprintln!();
- eprintln!("πŸ”§ {cyan_bold}Configuration changes:{cyan_bold:#}");
+ eprintln!("{HINT_EMOJI} {cyan_bold}Configuration changes:{cyan_bold:#}");
eprintln!();
for result in results {
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index ced825fa9..c58b4c721 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -1,8 +1,8 @@
use worktrunk::config::{ProjectConfig, WorktrunkConfig};
use worktrunk::git::{GitError, Repository};
use worktrunk::styling::{
- AnstyleStyle, CYAN, CYAN_BOLD, ERROR, ERROR_EMOJI, GREEN, GREEN_BOLD, HINT, HINT_EMOJI, eprint,
- eprintln, format_with_gutter, println,
+ AnstyleStyle, CYAN, CYAN_BOLD, ERROR, ERROR_EMOJI, GREEN, GREEN_BOLD, HINT, HINT_EMOJI,
+ SUCCESS_EMOJI, eprint, eprintln, format_with_gutter, println,
};
use super::command_executor::{CommandContext, prepare_project_commands};
@@ -34,7 +34,7 @@ pub fn handle_merge(
// Check if already on target branch
if current_branch == target_branch {
println!(
- "βœ… {GREEN}Already on {GREEN_BOLD}{target_branch}{GREEN_BOLD:#}, nothing to merge{GREEN:#}"
+ "{SUCCESS_EMOJI} {GREEN}Already on {GREEN_BOLD}{target_branch}{GREEN_BOLD:#}, nothing to merge{GREEN:#}"
);
return Ok(());
}
@@ -242,7 +242,7 @@ fn handle_commit_changes(
repo.run_command(&["commit", "-m", &commit_message])
.map_err(|e| GitError::CommandFailed(format!("Failed to commit: {}", e)))?;
- println!("βœ… {GREEN}Committed changes{GREEN:#}");
+ println!("{SUCCESS_EMOJI} {GREEN}Committed changes{GREEN:#}");
Ok(())
}
@@ -325,7 +325,7 @@ fn handle_squash(target_branch: &str) -> Result<Option<usize>, GitError> {
.map_err(|e| GitError::CommandFailed(format!("Failed to create squash commit: {}", e)))?;
crate::output::progress(format!(
- "βœ… {GREEN}Squashed {commit_count} commits into one{GREEN:#}"
+ "{SUCCESS_EMOJI} {GREEN}Squashed {commit_count} commits into one{GREEN:#}"
))
.map_err(|e| GitError::CommandFailed(e.to_string()))?;
Ok(Some(commit_count))
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 71a1f1977..63cda4039 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -105,7 +105,7 @@ use worktrunk::config::{ProjectConfig, WorktrunkConfig};
use worktrunk::git::{GitError, Repository};
use worktrunk::styling::{
ADDITION, AnstyleStyle, CYAN, CYAN_BOLD, DELETION, ERROR, ERROR_EMOJI, GREEN, GREEN_BOLD, HINT,
- HINT_EMOJI, WARNING, WARNING_EMOJI, eprint, eprintln, format_with_gutter,
+ HINT_EMOJI, SUCCESS_EMOJI, WARNING, WARNING_EMOJI, eprint, eprintln, format_with_gutter,
};
use super::command_executor::{CommandContext, prepare_project_commands};
@@ -664,13 +664,13 @@ pub fn handle_push(target: Option<&str>, allow_merge_commits: bool) -> Result<()
}
crate::output::progress(format!(
- "βœ… {GREEN}Pushed to {GREEN_BOLD}{target_branch}{GREEN_BOLD:#} ({}) {GREEN:#}",
+ "{SUCCESS_EMOJI} {GREEN}Pushed to {GREEN_BOLD}{target_branch}{GREEN_BOLD:#} ({}) {GREEN:#}",
summary_parts.join(", ")
))
.map_err(|e| GitError::CommandFailed(e.to_string()))?;
} else {
crate::output::progress(format!(
- "βœ… {GREEN}Pushed to {GREEN_BOLD}{target_branch}{GREEN_BOLD:#}{GREEN:#}"
+ "{SUCCESS_EMOJI} {GREEN}Pushed to {GREEN_BOLD}{target_branch}{GREEN_BOLD:#}{GREEN:#}"
))
.map_err(|e| GitError::CommandFailed(e.to_string()))?;
}
diff --git a/src/main.rs b/src/main.rs
index a003f9b38..c5fa210aa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,7 +3,7 @@ use clap::{CommandFactory, Parser, Subcommand};
use std::process;
use worktrunk::config::WorktrunkConfig;
use worktrunk::git::GitError;
-use worktrunk::styling::println;
+use worktrunk::styling::{SUCCESS_EMOJI, println};
mod commands;
mod display;
@@ -266,7 +266,7 @@ fn main() {
if changes_count == 0 {
// All shells already configured
let green = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
- println!("βœ… {green}All shells already configured{green:#}");
+ println!("{SUCCESS_EMOJI} {green}All shells already configured{green:#}");
return;
}
@@ -288,7 +288,9 @@ fn main() {
println!();
let green = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green)));
let plural = if changes_count == 1 { "" } else { "s" };
- println!("βœ… {green}Configured {changes_count} shell{plural}{green:#}");
+ println!(
+ "{SUCCESS_EMOJI} {green}Configured {changes_count} shell{plural}{green:#}"
+ );
// Show hint about restarting shell
println!();
diff --git a/src/output/interactive.rs b/src/output/interactive.rs
index a3dc85095..7811b83ad 100644
--- a/src/output/interactive.rs
+++ b/src/output/interactive.rs
@@ -2,7 +2,7 @@
use std::io::{self, Write};
use std::path::Path;
-use worktrunk::styling::{GREEN, println};
+use worktrunk::styling::{GREEN, SUCCESS_EMOJI, println};
/// Interactive output mode for human users
///
@@ -19,7 +19,7 @@ impl InteractiveOutput {
}
pub fn success(&mut self, message: String) -> io::Result<()> {
- println!("βœ… {GREEN}{message}{GREEN:#}");
+ println!("{SUCCESS_EMOJI} {GREEN}{message}{GREEN:#}");
Ok(())
}
diff --git a/src/styling.rs b/src/styling.rs
index 9082af0a4..470e75196 100644
--- a/src/styling.rs
+++ b/src/styling.rs
@@ -46,6 +46,9 @@ pub const ERROR: Style = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red))
/// Progress emoji - use with cyan style: `println!("{PROGRESS_EMOJI} {cyan}message{cyan:#}");`
pub const PROGRESS_EMOJI: &str = "πŸ”„";
+/// Success emoji - use with GREEN style: `println!("{SUCCESS_EMOJI} {GREEN}message{GREEN:#}");`
+pub const SUCCESS_EMOJI: &str = "βœ…";
+
/// Error emoji - use with ERROR style: `eprintln!("{ERROR_EMOJI} {ERROR}message{ERROR:#}");`
pub const ERROR_EMOJI: &str = "❌";
diff --git a/tests/integration_tests/completion_validation.rs b/tests/integration_tests/completion_validation.rs
index 3fc004415..6cac22188 100644
--- a/tests/integration_tests/completion_validation.rs
+++ b/tests/integration_tests/completion_validation.rs
@@ -1,5 +1,6 @@
use assert_cmd::Command;
use std::collections::HashSet;
+use worktrunk::styling::SUCCESS_EMOJI;
/// Issue found during validation
#[derive(Debug)]
@@ -322,6 +323,6 @@ fn test_completion_validation() {
}
if errors.is_empty() && warnings.is_empty() {
- println!("βœ… All shell completions validated successfully!");
+ println!("{SUCCESS_EMOJI} All shell completions validated successfully!");
}
}