diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-09 12:15:21 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-09 12:15:53 +0900 |
| commit | f18c18cd15f180b5067069ec6f10530515715f3d (patch) | |
| tree | 85ea3d3f10da9b32359dc3797fc7e6d262ae6752 /crates/mozart/src/commands/status.rs | |
| parent | f0192390ae1d89981f59395307e885a595f86eef (diff) | |
| download | php-mozart-f18c18cd15f180b5067069ec6f10530515715f3d.tar.gz php-mozart-f18c18cd15f180b5067069ec6f10530515715f3d.tar.zst php-mozart-f18c18cd15f180b5067069ec6f10530515715f3d.zip | |
refactor(console): accept format args directly in console_writeln! macros
Eliminate the nested &console_format!(...) boilerplate at every call site
by teaching console_writeln!, console_write!, console_writeln_error!, and
console_write_error! to accept a format literal + variadic args directly,
matching the println!/eprintln! ergonomics. Propagate the format string
span into generated code so rustc errors point to the right location.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/status.rs')
| -rw-r--r-- | crates/mozart/src/commands/status.rs | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/crates/mozart/src/commands/status.rs b/crates/mozart/src/commands/status.rs index 8647078..30d7396 100644 --- a/crates/mozart/src/commands/status.rs +++ b/crates/mozart/src/commands/status.rs @@ -2,7 +2,6 @@ use clap::Args; use indexmap::IndexMap; use mozart_core::composer::{Composer, InstallationSource, LocalPackage}; use mozart_core::console::Console; -use mozart_core::console_format; use mozart_core::console_writeln; use mozart_core::console_writeln_error; use mozart_core::exit_code; @@ -100,7 +99,7 @@ pub async fn execute( } if errors.is_empty() && unpushed_changes.is_empty() && vcs_version_changes.is_empty() { - console_writeln_error!(console, &console_format!("<info>No local changes</info>")); + console_writeln_error!(console, "<info>No local changes</info>"); return Ok(()); } @@ -110,14 +109,14 @@ pub async fn execute( if !errors.is_empty() { console_writeln_error!( console, - &console_format!("<error>You have changes in the following dependencies:</error>") + "<error>You have changes in the following dependencies:</error>" ); for (path, changes) in &errors { if verbose { - console_writeln!(console, &console_format!("<info>{path}</info>:")); - console_writeln!(console, &indent_block(changes)); + console_writeln!(console, "<info>{path}</info>:"); + console_writeln!(console, "{}", &indent_block(changes)); } else { - console_writeln!(console, path); + console_writeln!(console, "{}", path); } } } @@ -125,16 +124,14 @@ pub async fn execute( if !unpushed_changes.is_empty() { console_writeln_error!( console, - &console_format!( - "<warning>You have unpushed changes on the current branch in the following dependencies:</warning>" - ) + "<warning>You have unpushed changes on the current branch in the following dependencies:</warning>" ); for (path, changes) in &unpushed_changes { if verbose { - console_writeln!(console, &console_format!("<info>{path}</info>:")); - console_writeln!(console, &indent_block(changes)); + console_writeln!(console, "<info>{path}</info>:"); + console_writeln!(console, "{}", &indent_block(changes)); } else { - console_writeln!(console, path); + console_writeln!(console, "{}", path); } } } @@ -142,9 +139,7 @@ pub async fn execute( if !vcs_version_changes.is_empty() { console_writeln_error!( console, - &console_format!( - "<warning>You have version variations in the following dependencies:</warning>" - ) + "<warning>You have version variations in the following dependencies:</warning>" ); for (path, change) in &vcs_version_changes { if verbose { @@ -162,15 +157,13 @@ pub async fn execute( prev.push_str(&format!(" ({})", change.previous.reference)); curr.push_str(&format!(" ({})", change.current.reference)); } - console_writeln!(console, &console_format!("<info>{path}</info>:")); + console_writeln!(console, "<info>{path}</info>:"); console_writeln!( console, - &console_format!( - " From <comment>{prev}</comment> to <comment>{curr}</comment>" - ) + " From <comment>{prev}</comment> to <comment>{curr}</comment>" ); } else { - console_writeln!(console, path); + console_writeln!(console, "{}", path); } } } |
