diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-06 04:02:24 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-06 04:05:13 +0900 |
| commit | 2bc47940be9359e34cfe50c64fe76234999bc716 (patch) | |
| tree | 52859450ba8704df79d22917aa132fc5b3a702a6 /crates/mozart/src/commands/check_platform_reqs.rs | |
| parent | bf96f8292c0e9818c8b5fc8713ca7506e4338a49 (diff) | |
| download | php-mozart-2bc47940be9359e34cfe50c64fe76234999bc716.tar.gz php-mozart-2bc47940be9359e34cfe50c64fe76234999bc716.tar.zst php-mozart-2bc47940be9359e34cfe50c64fe76234999bc716.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/check_platform_reqs.rs')
| -rw-r--r-- | crates/mozart/src/commands/check_platform_reqs.rs | 40 |
1 files changed, 13 insertions, 27 deletions
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!( + "<warning>No vendor dir present, checking {}platform requirements from the lock file</warning>", + 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!( + "<warning>No vendor dir present, checking {}platform requirements from the lock file</warning>", + 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!( + "<info>{padded_name}</info> <comment>{padded_version}</comment> <info>success</info>" ), ); } @@ -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!( + "<comment>{padded_name}</comment> <comment>{padded_version}</comment> <error>failed</error> 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!( + "<comment>{padded_name}</comment> <comment>{padded_version}</comment> <error>missing</error> requires {} ({})", provider, constraint, ), |
