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/outdated_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/outdated_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/outdated_command.rs | 93 |
1 files changed, 75 insertions, 18 deletions
diff --git a/crates/shirabe/src/command/outdated_command.rs b/crates/shirabe/src/command/outdated_command.rs index 89edb44..f14ebe3 100644 --- a/crates/shirabe/src/command/outdated_command.rs +++ b/crates/shirabe/src/command/outdated_command.rs @@ -53,73 +53,130 @@ impl OutdatedCommand { 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 mut args: IndexMap<String, PhpMixed> = IndexMap::new(); args.insert("command".to_string(), PhpMixed::String("show".to_string())); args.insert("--latest".to_string(), PhpMixed::Bool(true)); if input + .borrow() .get_option("no-interaction") .as_bool() .unwrap_or(false) { args.insert("--no-interaction".to_string(), PhpMixed::Bool(true)); } - if input.get_option("no-plugins").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("no-plugins") + .as_bool() + .unwrap_or(false) + { args.insert("--no-plugins".to_string(), PhpMixed::Bool(true)); } - if input.get_option("no-scripts").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("no-scripts") + .as_bool() + .unwrap_or(false) + { args.insert("--no-scripts".to_string(), PhpMixed::Bool(true)); } - if input.get_option("no-cache").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("no-cache") + .as_bool() + .unwrap_or(false) + { args.insert("--no-cache".to_string(), PhpMixed::Bool(true)); } - if !input.get_option("all").as_bool().unwrap_or(false) { + if !input.borrow().get_option("all").as_bool().unwrap_or(false) { args.insert("--outdated".to_string(), PhpMixed::Bool(true)); } - if input.get_option("direct").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("direct") + .as_bool() + .unwrap_or(false) + { args.insert("--direct".to_string(), PhpMixed::Bool(true)); } - let package_arg = input.get_argument("package"); + let package_arg = input.borrow().get_argument("package"); if !matches!(package_arg, PhpMixed::Null) { args.insert("package".to_string(), package_arg); } - if input.get_option("strict").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("strict") + .as_bool() + .unwrap_or(false) + { args.insert("--strict".to_string(), PhpMixed::Bool(true)); } - if input.get_option("major-only").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("major-only") + .as_bool() + .unwrap_or(false) + { args.insert("--major-only".to_string(), PhpMixed::Bool(true)); } - if input.get_option("minor-only").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("minor-only") + .as_bool() + .unwrap_or(false) + { args.insert("--minor-only".to_string(), PhpMixed::Bool(true)); } - if input.get_option("patch-only").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("patch-only") + .as_bool() + .unwrap_or(false) + { args.insert("--patch-only".to_string(), PhpMixed::Bool(true)); } - if input.get_option("locked").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("locked") + .as_bool() + .unwrap_or(false) + { args.insert("--locked".to_string(), PhpMixed::Bool(true)); } - if input.get_option("no-dev").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("no-dev") + .as_bool() + .unwrap_or(false) + { args.insert("--no-dev".to_string(), PhpMixed::Bool(true)); } - if input.get_option("sort-by-age").as_bool().unwrap_or(false) { + if input + .borrow() + .get_option("sort-by-age") + .as_bool() + .unwrap_or(false) + { args.insert("--sort-by-age".to_string(), PhpMixed::Bool(true)); } args.insert( "--ignore-platform-req".to_string(), - input.get_option("ignore-platform-req"), + input.borrow().get_option("ignore-platform-req"), ); if input + .borrow() .get_option("ignore-platform-reqs") .as_bool() .unwrap_or(false) { args.insert("--ignore-platform-reqs".to_string(), PhpMixed::Bool(true)); } - args.insert("--format".to_string(), input.get_option("format")); - args.insert("--ignore".to_string(), input.get_option("ignore")); + args.insert("--format".to_string(), input.borrow().get_option("format")); + args.insert("--ignore".to_string(), input.borrow().get_option("ignore")); let input = ArrayInput::new(args); |
