diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-06 03:38:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-06 04:05:13 +0900 |
| commit | bf96f8292c0e9818c8b5fc8713ca7506e4338a49 (patch) | |
| tree | 61ddecc119ee0ae344eabdb9c0f784cdb3461a44 /crates/mozart/src/commands/search.rs | |
| parent | b97e34358be5df05a3db9f5f3ef1502eaa94b1c0 (diff) | |
| download | php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.tar.gz php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.tar.zst php-mozart-bf96f8292c0e9818c8b5fc8713ca7506e4338a49.zip | |
refactor(console): add write macros and migrate commands to use them
Diffstat (limited to 'crates/mozart/src/commands/search.rs')
| -rw-r--r-- | crates/mozart/src/commands/search.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/mozart/src/commands/search.rs b/crates/mozart/src/commands/search.rs index 2ee84de..25d32da 100644 --- a/crates/mozart/src/commands/search.rs +++ b/crates/mozart/src/commands/search.rs @@ -1,6 +1,6 @@ use clap::Args; -use mozart_core::console::Verbosity; use mozart_core::console_format; +use mozart_core::console_writeln; use mozart_registry::packagist::SearchResult; use serde::Serialize; @@ -151,7 +151,7 @@ pub async fn execute( match format { "json" => { let json = serde_json::to_string_pretty(&vendor_names)?; - console.write_stdout(&json, Verbosity::Normal); + console_writeln!(console, &json); } _ => { if vendor_names.is_empty() { @@ -160,10 +160,7 @@ pub async fn execute( )); } else { for vendor in &vendor_names { - console.write_stdout( - &console_format!("<info>{vendor}</info>"), - Verbosity::Normal, - ); + console_writeln!(console, &console_format!("<info>{vendor}</info>"),); } } } @@ -179,7 +176,7 @@ pub async fn execute( .map(|r| SearchResultOutput::from(*r)) .collect(); let json = serde_json::to_string_pretty(&output)?; - console.write_stdout(&json, Verbosity::Normal); + console_writeln!(console, &json); } _ => { if results.is_empty() { @@ -210,9 +207,9 @@ pub async fn execute( }; let padding = " ".repeat(name_width.saturating_sub(result.name.len())); - console.write_stdout( + console_writeln!( + console, &format!("{}{}{}{}", result.name, padding, warning, desc_display), - Verbosity::Normal, ); } } |
