Skip to content

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

Style: Apply styling to completion and init error messages

Maximilian Roosca7efd0727dd
diff --git a/src/commands/completion.rs b/src/commands/completion.rs
index d8bad6124..7e36cd5bd 100644
--- a/src/commands/completion.rs
+++ b/src/commands/completion.rs
@@ -15,6 +15,7 @@ use clap_complete::{Shell as CompletionShell, generate};
use std::io;
use worktrunk::git::{GitError, Repository};
use worktrunk::shell::Shell;
+use worktrunk::styling::{ERROR, ERROR_EMOJI, eprintln};
pub fn handle_completion(shell: Shell, cli_cmd: &mut Command) {
let completion_shell = match shell {
@@ -114,7 +115,7 @@ where
{
get_branches_fn().unwrap_or_else(|e| {
if std::env::var("WT_DEBUG_COMPLETION").is_ok() {
- eprintln!("completion error: {}", e);
+ eprintln!("{ERROR_EMOJI} {ERROR}Completion error: {e}{ERROR:#}");
}
Vec::new()
})
diff --git a/src/commands/init.rs b/src/commands/init.rs
index dc41b0677..cc0846a1c 100644
--- a/src/commands/init.rs
+++ b/src/commands/init.rs
@@ -1,6 +1,7 @@
use clap::Command;
use clap_complete::{Shell as CompletionShell, generate};
use worktrunk::shell;
+use worktrunk::styling::{ERROR, ERROR_EMOJI, eprintln};
pub fn handle_init(shell_name: &str, cmd_name: &str, cli_cmd: &mut Command) -> Result<(), String> {
let shell = shell_name.parse::<shell::Shell>()?;
@@ -20,7 +21,7 @@ pub fn handle_init(shell_name: &str, cmd_name: &str, cli_cmd: &mut Command) -> R
// Check if shell supports completion
if !shell.supports_completion() {
- eprintln!("Completion not yet supported for {}", shell);
+ eprintln!("{ERROR_EMOJI} {ERROR}Completion not yet supported for {shell}{ERROR:#}");
std::process::exit(1);
}