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/dependency.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/dependency.rs')
| -rw-r--r-- | crates/mozart/src/commands/dependency.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/crates/mozart/src/commands/dependency.rs b/crates/mozart/src/commands/dependency.rs index 3b6f8c4..d0f2d48 100644 --- a/crates/mozart/src/commands/dependency.rs +++ b/crates/mozart/src/commands/dependency.rs @@ -10,6 +10,7 @@ use std::path::Path; use anyhow::Result; use mozart_core::console_format; +use mozart_core::console_writeln; /// Inputs for [`do_execute`], collected from the `depends` / `prohibits` CLI args. pub struct DoExecuteArgs<'a> { @@ -89,13 +90,13 @@ pub fn do_execute( if results.is_empty() { if inverted { - console.write_stdout( + console_writeln!( + console, &console_format!( "<info>{} {} can be installed.</info>", package, version.unwrap_or("") ), - mozart_core::console::Verbosity::Normal, ); return Ok(()); } @@ -647,9 +648,9 @@ fn sample_versions_from_constraint( /// Columns: package name | version | link description | link constraint pub fn print_table(results: &[DependencyResult], console: &mozart_core::console::Console) { if results.is_empty() { - console.write_stdout( + console_writeln!( + console, &format!("{}", mozart_core::console::info("No relationships found.")), - mozart_core::console::Verbosity::Normal, ); return; } @@ -680,7 +681,8 @@ pub fn print_table(results: &[DependencyResult], console: &mozart_core::console: if !seen.insert(key) { continue; } - console.write_stdout( + console_writeln!( + console, &format!( "{:<name_w$} {:<ver_w$} {:<desc_w$} {}", mozart_core::console::info(&r.package_name), @@ -691,7 +693,6 @@ pub fn print_table(results: &[DependencyResult], console: &mozart_core::console: ver_w = ver_w, desc_w = desc_w, ), - mozart_core::console::Verbosity::Normal, ); } } @@ -711,9 +712,9 @@ pub fn print_tree( console: &mozart_core::console::Console, ) { if results.is_empty() && depth == 0 { - console.write_stdout( + console_writeln!( + console, &format!("{}", mozart_core::console::info("No relationships found.")), - mozart_core::console::Verbosity::Normal, ); return; } @@ -723,7 +724,8 @@ pub fn print_tree( let is_last = i + 1 == count; let prefix = tree_prefix(depth, is_last); - console.write_stdout( + console_writeln!( + console, &format!( "{}{:<} {} {} {}", prefix, @@ -732,7 +734,6 @@ pub fn print_tree( r.link_description, mozart_core::console::comment(&r.link_constraint), ), - mozart_core::console::Verbosity::Normal, ); if !r.children.is_empty() { |
