From d5b313f388d424e60ae33ae58c1a65a65b24b8f1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 18:04:45 +0900 Subject: refactor(command): share Input/OutputInterface via Rc Convert InputInterface and OutputInterface parameters from &dyn/&mut dyn references to Rc> shared ownership across the command, console, and IO layers, matching the Phase C shared-ownership approach already used for IOInterface. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/exec_command.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/command/exec_command.rs') diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs index cfc0e89..b086937 100644 --- a/crates/shirabe/src/command/exec_command.rs +++ b/crates/shirabe/src/command/exec_command.rs @@ -41,16 +41,16 @@ impl ExecCommand { pub fn interact( &mut self, - input: &mut dyn InputInterface, - _output: &dyn OutputInterface, + input: std::rc::Rc>, + _output: std::rc::Rc>, ) -> Result<()> { let binaries = self.get_binaries(false)?; if binaries.is_empty() { return Ok(()); } - if input.get_argument("binary").as_string().is_some() - || input.get_option("list").as_bool().unwrap_or(false) + if input.borrow().get_argument("binary").as_string().is_some() + || input.borrow().get_option("list").as_bool().unwrap_or(false) { return Ok(()); } @@ -66,7 +66,7 @@ impl ExecCommand { ); if let Some(idx) = binary.as_int() { - input.set_argument( + input.borrow_mut().set_argument( "binary", shirabe_php_shim::PhpMixed::String(binaries[idx as usize].clone()), ); @@ -77,13 +77,13 @@ impl ExecCommand { pub fn execute( &mut self, - input: &dyn InputInterface, - _output: &dyn OutputInterface, + input: std::rc::Rc>, + _output: std::rc::Rc>, ) -> Result { let composer = self.require_composer(None, None)?; - if input.get_option("list").as_bool().unwrap_or(false) - || input.get_argument("binary").as_string().is_none() + if input.borrow().get_option("list").as_bool().unwrap_or(false) + || input.borrow().get_argument("binary").as_string().is_none() { let bins = self.get_binaries(true)?; if bins.is_empty() { @@ -114,6 +114,7 @@ impl ExecCommand { } let binary = input + .borrow() .get_argument("binary") .as_string() .unwrap_or("") @@ -139,6 +140,7 @@ impl ExecCommand { } let args = input + .borrow() .get_argument("args") .as_list() .map(|l| { -- cgit v1.3.1