diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-06 18:04:45 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-06 18:04:45 +0900 |
| commit | d5b313f388d424e60ae33ae58c1a65a65b24b8f1 (patch) | |
| tree | 849ada9b7319b8eb85aab28e02f614023fea2105 /crates/shirabe/src/command/licenses_command.rs | |
| parent | 71b432db3f115d17be498f36cd3efd40b4650a0b (diff) | |
| download | php-shirabe-d5b313f388d424e60ae33ae58c1a65a65b24b8f1.tar.gz php-shirabe-d5b313f388d424e60ae33ae58c1a65a65b24b8f1.tar.zst php-shirabe-d5b313f388d424e60ae33ae58c1a65a65b24b8f1.zip | |
refactor(command): share Input/OutputInterface via Rc<RefCell>
Convert InputInterface and OutputInterface parameters from &dyn/&mut dyn
references to Rc<RefCell<dyn ...>> 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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/licenses_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/licenses_command.rs | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/crates/shirabe/src/command/licenses_command.rs b/crates/shirabe/src/command/licenses_command.rs index d870acb..79c86d1 100644 --- a/crates/shirabe/src/command/licenses_command.rs +++ b/crates/shirabe/src/command/licenses_command.rs @@ -76,14 +76,19 @@ impl LicensesCommand { pub fn execute( &mut self, - input: &dyn InputInterface, - output: &dyn OutputInterface, + input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, + output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, ) -> Result<i64> { let composer = self.require_composer(None, None)?; let mut composer = crate::command::composer_full_mut(&composer); // TODO(plugin): dispatch COMMAND event for plugin hooks - let command_event = CommandEvent::new(PluginEvents::COMMAND, "licenses", input, output); + let command_event = CommandEvent::new( + PluginEvents::COMMAND, + "licenses", + input.clone(), + output.clone(), + ); composer .get_event_dispatcher() .borrow_mut() @@ -91,7 +96,12 @@ impl LicensesCommand { let root = composer.get_package(); - let packages = if input.get_option("locked").as_bool().unwrap_or(false) { + let packages = if input + .borrow() + .get_option("locked") + .as_bool() + .unwrap_or(false) + { let locker = composer.get_locker().clone(); let mut locker = locker.borrow_mut(); if !locker.is_locked() { @@ -100,7 +110,11 @@ impl LicensesCommand { code: 0, }.into()); } - let no_dev = input.get_option("no-dev").as_bool().unwrap_or(false); + let no_dev = input + .borrow() + .get_option("no-dev") + .as_bool() + .unwrap_or(false); let repo = locker.get_locked_repository(!no_dev)?; repo.borrow_mut().get_packages()? } else { @@ -108,7 +122,12 @@ impl LicensesCommand { let repository_manager = repository_manager.borrow(); let repo = repository_manager.get_local_repository(); - if input.get_option("no-dev").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("no-dev") + .as_bool() + .unwrap_or(false) + { RepositoryUtils::filter_required_packages( &repo.get_packages()?, composer.get_package().clone().into(), @@ -126,6 +145,7 @@ impl LicensesCommand { let io = self.get_io(); let format = input + .borrow() .get_option("format") .as_string() .unwrap_or("text") |
