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/repository_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/repository_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/repository_command.rs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/crates/shirabe/src/command/repository_command.rs b/crates/shirabe/src/command/repository_command.rs index d57a98d..5ced013 100644 --- a/crates/shirabe/src/command/repository_command.rs +++ b/crates/shirabe/src/command/repository_command.rs @@ -68,25 +68,29 @@ impl RepositoryCommand { 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>>, ) -> anyhow::Result<i64> { let action = strtolower( &input + .borrow() .get_argument("action") .as_string() .unwrap_or("") .to_string(), ); let name = input + .borrow() .get_argument("name") .as_string() .map(|s| s.to_string()); let arg1 = input + .borrow() .get_argument("arg1") .as_string() .map(|s| s.to_string()); let arg2 = input + .borrow() .get_argument("arg2") .as_string() .map(|s| s.to_string()); @@ -143,10 +147,15 @@ impl RepositoryCommand { }; let before = input + .borrow() .get_option("before") .as_string() .map(|s| s.to_string()); - let after = input.get_option("after").as_string().map(|s| s.to_string()); + let after = input + .borrow() + .get_option("after") + .as_string() + .map(|s| s.to_string()); if before.is_some() && after.is_some() { return Err(anyhow::anyhow!(RuntimeException { message: "You can not combine --before and --after".to_string(), @@ -173,7 +182,11 @@ impl RepositoryCommand { return Ok(0); } - let append = input.get_option("append").as_bool().unwrap_or(false); + let append = input + .borrow() + .get_option("append") + .as_bool() + .unwrap_or(false); self.config_source.as_mut().unwrap().add_repository( name.as_deref().unwrap(), repo_config.clone(), @@ -270,7 +283,11 @@ impl RepositoryCommand { } let name_str = name.as_deref().unwrap(); if ["packagist", "packagist.org"].contains(&name_str) { - let append = input.get_option("append").as_bool().unwrap_or(false); + let append = input + .borrow() + .get_option("append") + .as_bool() + .unwrap_or(false); self.config_source.as_mut().unwrap().add_repository( "packagist.org", PhpMixed::Bool(false), |
