From 46845eff8d1398f35099a0ef914f77bcaf473287 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 10 May 2026 15:29:19 +0900 Subject: refactor(io): introduce IoInterface trait mirroring Composer IOInterface Add an `IoInterface` trait in mozart-core::console that mirrors `\Composer\IO\IOInterface`, implement it for `Console`, and switch commands, the auditor, and the suggested-packages reporter to accept the abstracted IO (typically `Arc>>` at the command boundary, `&dyn IoInterface` deeper down) instead of `&Console`. The console_writeln\!/write\! macros now go through `IoInterface::verbosity()` via the lock so any implementor works. --- crates/mozart/src/commands/exec.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/mozart/src/commands/exec.rs') diff --git a/crates/mozart/src/commands/exec.rs b/crates/mozart/src/commands/exec.rs index 63c29c9..9cbb478 100644 --- a/crates/mozart/src/commands/exec.rs +++ b/crates/mozart/src/commands/exec.rs @@ -1,7 +1,7 @@ use crate::composer::Composer; use clap::Args; -use mozart_core::console_writeln; use mozart_core::package::Package; +use mozart_core::{console::IoInterface, console_writeln}; use std::path::{Path, PathBuf}; #[derive(Args)] @@ -21,7 +21,7 @@ pub struct ExecArgs { pub async fn execute( args: &ExecArgs, cli: &super::Cli, - console: &mozart_core::console::Console, + io: std::sync::Arc>>, ) -> anyhow::Result<()> { let working_dir = cli.working_dir()?; @@ -36,12 +36,12 @@ pub async fn execute( bin_dir.display(), ); } - console_writeln!(console, "Available binaries:"); + console_writeln!(io, "Available binaries:"); for (bin, is_local) in &bins { if *is_local { - console_writeln!(console, "- {bin} (local)"); + console_writeln!(io, "- {bin} (local)"); } else { - console_writeln!(console, "- {bin}"); + console_writeln!(io, "- {bin}"); } } return Ok(()); -- cgit v1.3.1