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/status_command.rs | 39 ++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'crates/shirabe/src/command/status_command.rs') diff --git a/crates/shirabe/src/command/status_command.rs b/crates/shirabe/src/command/status_command.rs index f651e59..0c9abc9 100644 --- a/crates/shirabe/src/command/status_command.rs +++ b/crates/shirabe/src/command/status_command.rs @@ -41,15 +41,16 @@ impl StatusCommand { pub fn execute( &mut self, - input: &dyn InputInterface, - output: &dyn OutputInterface, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> Result { let composer_rc = self.require_composer(None, None)?; { let composer = crate::command::composer_full(&composer_rc); // TODO(plugin): dispatch CommandEvent - let command_event = CommandEvent::new(PluginEvents::COMMAND, "status", input, output); + let command_event = + CommandEvent::new(PluginEvents::COMMAND, "status", input.clone(), output); composer .get_event_dispatcher() .borrow_mut() @@ -84,7 +85,10 @@ impl StatusCommand { Ok(exit_code) } - fn do_execute(&mut self, input: &dyn InputInterface) -> Result { + fn do_execute( + &mut self, + input: std::rc::Rc>, + ) -> Result { let composer = self.require_composer(None, None)?; let mut composer = crate::command::composer_full_mut(&composer); let io = self.get_io().clone(); @@ -212,7 +216,12 @@ impl StatusCommand { io.write_error("You have changes in the following dependencies:"); for (path, changes) in &errors { - if input.get_option("verbose").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("verbose") + .as_bool() + .unwrap_or(false) + { let indented_changes = changes .lines() .map(|line| format!(" {}", line.trim_start())) @@ -230,7 +239,12 @@ impl StatusCommand { io.write_error("You have unpushed changes on the current branch in the following dependencies:"); for (path, changes) in &unpushed_changes { - if input.get_option("verbose").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("verbose") + .as_bool() + .unwrap_or(false) + { let indented_changes = changes .lines() .map(|line| format!(" {}", line.trim_start())) @@ -250,7 +264,12 @@ impl StatusCommand { ); for (path, changes) in &vcs_version_changes { - if input.get_option("verbose").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("verbose") + .as_bool() + .unwrap_or(false) + { let current_version = { let v = changes["current"] .get("version") @@ -311,7 +330,11 @@ impl StatusCommand { } if (!errors.is_empty() || !unpushed_changes.is_empty() || !vcs_version_changes.is_empty()) - && !input.get_option("verbose").as_bool().unwrap_or(false) + && !input + .borrow() + .get_option("verbose") + .as_bool() + .unwrap_or(false) { io.write_error("Use --verbose (-v) to see a list of files"); } -- cgit v1.3.1