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-core | |
| 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-core')
| -rw-r--r-- | crates/mozart-core/src/console.rs | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/crates/mozart-core/src/console.rs b/crates/mozart-core/src/console.rs index 734074e..b8db17e 100644 --- a/crates/mozart-core/src/console.rs +++ b/crates/mozart-core/src/console.rs @@ -3,36 +3,42 @@ use dialoguer::{Confirm, Input}; use std::io::IsTerminal; // --------------------------------------------------------------------------- -// Tag-style color helpers (module-level free functions, unchanged API) +// Tag-style color helpers — called only by `console_format!` // --------------------------------------------------------------------------- -/// `<info>` — green foreground -pub fn info(message: &str) -> ColoredString { +/// `<info>` — green foreground. +/// Do not call directly; use the `console_format!` macro instead. +pub fn __format_info_message(message: &str) -> ColoredString { message.green() } -/// `<comment>` — yellow foreground -pub fn comment(message: &str) -> ColoredString { +/// `<comment>` — yellow foreground. +/// Do not call directly; use the `console_format!` macro instead. +pub fn __format_comment_message(message: &str) -> ColoredString { message.yellow() } -/// `<error>` — white on red -pub fn error(message: &str) -> ColoredString { +/// `<error>` — white on red. +/// Do not call directly; use the `console_format!` macro instead. +pub fn __format_error_message(message: &str) -> ColoredString { message.white().on_red() } -/// `<question>` — black on cyan -pub fn question(message: &str) -> ColoredString { +/// `<question>` — black on cyan. +/// Do not call directly; use the `console_format!` macro instead. +pub fn __format_question_message(message: &str) -> ColoredString { message.black().on_cyan() } -/// `<highlight>` — red foreground (Composer extension) -pub fn highlight(message: &str) -> ColoredString { +/// `<highlight>` — red foreground (Composer extension). +/// Do not call directly; use the `console_format!` macro instead. +pub fn __format_highlight_message(message: &str) -> ColoredString { message.red() } -/// `<warning>` — black on yellow (Composer extension) -pub fn warning(message: &str) -> ColoredString { +/// `<warning>` — black on yellow (Composer extension). +/// Do not call directly; use the `console_format!` macro instead. +pub fn __format_warning_message(message: &str) -> ColoredString { message.black().on_yellow() } @@ -148,7 +154,7 @@ impl Console { /// Write an error to stderr. Always shown, even in quiet mode. pub fn write_error(&self, msg: &str) { - eprintln!("{}", error(msg)); + eprintln!("{}", __format_error_message(msg)); } // Convenience verbosity-level shortcuts: |
