From 6f3802fd9f39c4e5847d130b4417b5cdfb66972d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 22 Feb 2026 22:53:09 +0900 Subject: refactor(console): add console_format! proc macro and migrate all commands Introduce a Symfony Console-style tag macro that replaces verbose patterns like `console::info(&format!("text {name}"))` with `console_format!("text {name}")`. Supports all 6 tag types (info, comment, error, question, highlight, warning) with format argument distribution across multiple tagged segments. Co-Authored-By: Claude Opus 4.6 --- crates/mozart/src/commands/search.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'crates/mozart/src/commands/search.rs') diff --git a/crates/mozart/src/commands/search.rs b/crates/mozart/src/commands/search.rs index f145460..06e67c9 100644 --- a/crates/mozart/src/commands/search.rs +++ b/crates/mozart/src/commands/search.rs @@ -1,4 +1,5 @@ use clap::Args; +use mozart_core::console_format; use mozart_registry::packagist::SearchResult; #[derive(Args)] @@ -75,9 +76,9 @@ pub async fn execute( if !matches!(format, "text" | "json") { eprintln!( "{}", - mozart_core::console::error(&format!( - "Unsupported format \"{format}\". See help for supported formats." - )) + console_format!( + "Unsupported format \"{format}\". See help for supported formats." + ) ); std::process::exit(1); } @@ -107,7 +108,7 @@ pub async fn execute( if results.is_empty() { eprintln!( "{}", - mozart_core::console::warning(&format!("No packages found for \"{query}\"")) + console_format!("No packages found for \"{query}\"") ); return Ok(()); } @@ -130,13 +131,9 @@ pub async fn execute( println!( "{} {} {}", - mozart_core::console::info(&format!( - "{:{:", result.name, width = name_width), + console_format!("{}", dl_str), + console_format!("{}", fav_str), ); if !result.description.is_empty() { println!(" {}", result.description); -- cgit v1.3.1