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/browse.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/browse.rs')
| -rw-r--r-- | crates/mozart/src/commands/browse.rs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/crates/mozart/src/commands/browse.rs b/crates/mozart/src/commands/browse.rs index 538cf6a..c4c957b 100644 --- a/crates/mozart/src/commands/browse.rs +++ b/crates/mozart/src/commands/browse.rs @@ -1,7 +1,6 @@ use clap::Args; use mozart_core::composer::Composer; 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; @@ -66,7 +65,8 @@ pub async fn execute(args: &BrowseArgs, cli: &super::Cli, console: &Console) -> return_code = 1; console_writeln_error!( console, - &console_format!("<warning>Package {} not found</warning>", package_name), + "<warning>Package {} not found</warning>", + package_name, ); } @@ -77,10 +77,7 @@ pub async fn execute(args: &BrowseArgs, cli: &super::Cli, console: &Console) -> } else { "Invalid or missing repository URL" }; - console_writeln_error!( - console, - &console_format!("<warning>{} for {}</warning>", kind, package_name), - ); + console_writeln_error!(console, "<warning>{} for {}</warning>", kind, package_name); } } @@ -125,7 +122,7 @@ fn handle_package( }; if show_only { - console_writeln!(console, &console_format!("<info>{}</info>", url)); + console_writeln!(console, "<info>{}</info>", url); } else { open_browser(&url, console)?; } @@ -156,10 +153,8 @@ fn open_browser(url: &str, console: &Console) -> anyhow::Result<()> { } else { console_writeln_error!( console, - &format!( - "No suitable browser opening command found, open yourself: {}", - url - ), + "No suitable browser opening command found, open yourself: {}", + url, ); } Ok(()) |
