From 2bc47940be9359e34cfe50c64fe76234999bc716 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 6 May 2026 04:02:24 +0900 Subject: refactor(console): rename color helpers and migrate call sites to console_format! The six tag-style color functions (info, comment, error, question, highlight, warning) are pub only so that console_format! can call them from generated code; they are not part of the public API. Rename them to __format_*_message to make that intent visible, add a doc-comment saying not to call them directly, and replace every remaining direct call site with console_format!. Co-Authored-By: Claude Sonnet 4.6 --- crates/mozart/src/commands/check_platform_reqs.rs | 40 ++++++++--------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'crates/mozart/src/commands/check_platform_reqs.rs') diff --git a/crates/mozart/src/commands/check_platform_reqs.rs b/crates/mozart/src/commands/check_platform_reqs.rs index e96610e..a5856ca 100644 --- a/crates/mozart/src/commands/check_platform_reqs.rs +++ b/crates/mozart/src/commands/check_platform_reqs.rs @@ -1,5 +1,6 @@ use clap::Args; use mozart_core::console::Console; +use mozart_core::console_format; use mozart_core::console_writeln; use mozart_core::console_writeln_error; use std::collections::BTreeMap; @@ -143,12 +144,9 @@ fn collect_requirements( // Fall through to lock file with a warning console_writeln_error!( console, - &format!( - "{}", - mozart_core::console::warning(&format!( - "No vendor dir present, checking {}platform requirements from the lock file", - dev_text - )) + &console_format!( + "No vendor dir present, checking {}platform requirements from the lock file", + dev_text ), ); if !lock_path.exists() { @@ -168,12 +166,9 @@ fn collect_requirements( // Fallback: read from lock file console_writeln_error!( console, - &format!( - "{}", - mozart_core::console::warning(&format!( - "No vendor dir present, checking {}platform requirements from the lock file", - dev_text - )) + &console_format!( + "No vendor dir present, checking {}platform requirements from the lock file", + dev_text ), ); collect_from_lock(&lock_path, args.no_dev, &mut requirements)?; @@ -365,11 +360,8 @@ fn render_text(results: &[CheckResult], console: &Console) { CheckStatus::Success => { console_writeln!( console, - &format!( - "{} {} {}", - mozart_core::console::info(&padded_name), - mozart_core::console::comment(&padded_version), - mozart_core::console::info("success"), + &console_format!( + "{padded_name} {padded_version} success" ), ); } @@ -381,11 +373,8 @@ fn render_text(results: &[CheckResult], console: &Console) { .unwrap_or(("", "")); console_writeln!( console, - &format!( - "{} {} {} requires {} ({})", - mozart_core::console::comment(&padded_name), - mozart_core::console::comment(&padded_version), - mozart_core::console::error("failed"), + &console_format!( + "{padded_name} {padded_version} failed requires {} ({})", provider, constraint, ), @@ -399,11 +388,8 @@ fn render_text(results: &[CheckResult], console: &Console) { .unwrap_or(("*", "")); console_writeln!( console, - &format!( - "{} {} {} requires {} ({})", - mozart_core::console::comment(&padded_name), - mozart_core::console::comment(&padded_version), - mozart_core::console::error("missing"), + &console_format!( + "{padded_name} {padded_version} missing requires {} ({})", provider, constraint, ), -- cgit v1.3.1