From d6e0c6d34449224ac3687daf551a0acfd15cee32 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 23 Feb 2026 15:11:36 +0900 Subject: refactor(cli): route command output through Console abstraction Replace direct println\!/eprintln\! calls with console.write(), console.info(), and console.write_stdout() across all command handlers to respect verbosity settings. Co-Authored-By: Claude Opus 4.6 --- crates/mozart/src/commands/bump.rs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'crates/mozart/src/commands/bump.rs') diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs index 7e74f80..957120d 100644 --- a/crates/mozart/src/commands/bump.rs +++ b/crates/mozart/src/commands/bump.rs @@ -1,4 +1,5 @@ use clap::Args; +use mozart_core::console::Verbosity; use mozart_core::console_format; use std::collections::HashMap; use std::path::PathBuf; @@ -154,34 +155,34 @@ pub async fn execute( let total_changes = require_changes.len() + require_dev_changes.len(); if total_changes == 0 { - println!( - "{}", - console_format!( + console.write_stdout( + &console_format!( "No requirements to update in {}.", composer_json_path.display() - ) + ), + Verbosity::Normal, ); return Ok(()); } if args.dry_run { - println!( - "{}", - console_format!( + console.write_stdout( + &console_format!( "{} would be updated with:", composer_json_path.display() - ) + ), + Verbosity::Normal, ); for (name, _old, new) in &require_changes { - println!( - "{}", - console_format!(" - require.{name}: {new}") + console.write_stdout( + &console_format!(" - require.{name}: {new}"), + Verbosity::Normal, ); } for (name, _old, new) in &require_dev_changes { - println!( - "{}", - console_format!(" - require-dev.{name}: {new}") + console.write_stdout( + &console_format!(" - require-dev.{name}: {new}"), + Verbosity::Normal, ); } // Return exit code 1 when dry-run detects changes (useful for CI to detect un-bumped constraints) @@ -209,12 +210,12 @@ pub async fn execute( updated_lock.content_hash = new_hash; updated_lock.write_to_file(&lock_path)?; - println!( - "{}", - console_format!( + console.write_stdout( + &console_format!( "{} has been updated ({total_changes} changes).", composer_json_path.display() - ) + ), + Verbosity::Normal, ); Ok(()) -- cgit v1.3.1