From f411daceacad66e0bd774fda7d3c5ef8533cc55c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 26 May 2026 20:04:02 +0900 Subject: refactor(io): share IOInterface via Rc> handle Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/io/console_io.rs | 63 +++++++++++-------------------------- 1 file changed, 19 insertions(+), 44 deletions(-) (limited to 'crates/shirabe/src/io/console_io.rs') diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs index b4bae47..2b1c334 100644 --- a/crates/shirabe/src/io/console_io.rs +++ b/crates/shirabe/src/io/console_io.rs @@ -5,7 +5,6 @@ use crate::io::io_interface; use indexmap::IndexMap; use indexmap::indexmap; use shirabe_external_packages::composer::pcre::Preg; -use shirabe_external_packages::psr::log::LoggerInterface; use shirabe_external_packages::symfony::component::console::helper::HelperSet; use shirabe_external_packages::symfony::component::console::helper::ProgressBar; use shirabe_external_packages::symfony::component::console::helper::Table; @@ -25,6 +24,8 @@ use std::cell::RefCell; use crate::io::BaseIO; use crate::io::IOInterface; +use crate::io::IOInterfaceImmutable; +use crate::io::IOInterfaceMutable; use crate::question::StrictConfirmationQuestion; use crate::util::Silencer; @@ -378,49 +379,7 @@ impl ConsoleIO { } } -impl LoggerInterface for ConsoleIO { - // TODO(phase-b): BaseIO's emergency/alert/.../log take PhpMixed and - // IndexMap> while LoggerInterface takes &str and - // &[(&str, &str)]. Delegation requires reconciling signatures; for now, - // mirror NullIO and panic via todo!(). - fn emergency(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn alert(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn critical(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn error(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn warning(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn notice(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn info(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn debug(&self, _message: &str, _context: &[(&str, &str)]) { - todo!() - } - - fn log(&self, _level: &str, _message: &str, _context: &[(&str, &str)]) { - todo!() - } -} - -impl IOInterface for ConsoleIO { +impl IOInterfaceImmutable for ConsoleIO { fn is_interactive(&self) -> bool { self.input.is_interactive() } @@ -690,6 +649,20 @@ impl IOInterface for ConsoleIO { ::get_authentication(self, repository_name) } + fn error(&self, _message: &str, _context: &[(&str, &str)]) { + todo!() + } + + fn warning(&self, _message: &str, _context: &[(&str, &str)]) { + todo!() + } + + fn debug(&self, _message: &str, _context: &[(&str, &str)]) { + todo!() + } +} + +impl IOInterfaceMutable for ConsoleIO { fn set_authentication( &mut self, repository_name: String, @@ -704,6 +677,8 @@ impl IOInterface for ConsoleIO { } } +impl IOInterface for ConsoleIO {} + impl BaseIO for ConsoleIO { fn authentications( &self, -- cgit v1.3.1