aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/update_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-29 00:16:56 +0900
committernsfisis <nsfisis@gmail.com>2026-05-29 00:23:32 +0900
commit7f83e785a77fbdbcada9c6714703d4e5801af82a (patch)
treeef7debc5cbc91d521db4dc5a563807c486dafd22 /crates/shirabe/src/command/update_command.rs
parent7715c98aaf3e3962cabbcf740e93fa817a2f8027 (diff)
downloadphp-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.tar.gz
php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.tar.zst
php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.zip
refactor(io): unify IOInterface params to Rc<RefCell<dyn _>>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/update_command.rs')
-rw-r--r--crates/shirabe/src/command/update_command.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs
index f1b05af..22ce506 100644
--- a/crates/shirabe/src/command/update_command.rs
+++ b/crates/shirabe/src/command/update_command.rs
@@ -24,6 +24,7 @@ use crate::console::input::InputOption;
use crate::dependency_resolver::request::{self, Request, UpdateAllowTransitiveDeps};
use crate::installer::Installer;
use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::package::loader::RootPackageLoader;
use crate::package::version::VersionParser;
use crate::package::version::VersionSelector;
@@ -75,11 +76,7 @@ impl UpdateCommand {
input: &dyn InputInterface,
output: &dyn OutputInterface,
) -> Result<i64> {
- // TODO(phase-b): clone_box avoids the &mut self conflict with require_composer
- // below; revisit when get_io can return an Rc/Arc owned handle.
- let io_box = self.get_io().clone();
- let io_ref = io_box.borrow();
- let io: &dyn IOInterface = &*io_ref;
+ let io = self.get_io().clone();
if input.get_option("dev").as_bool().unwrap_or(false) {
io.write_error3(
"<warning>You are using the deprecated option \"--dev\". It has no effect and will break in Composer 3.</warning>",
@@ -248,8 +245,13 @@ impl UpdateCommand {
}
if input.get_option("interactive").as_bool().unwrap_or(false) {
- packages =
- self.get_packages_interactively(io, input, output, &composer_handle, packages)?;
+ packages = self.get_packages_interactively(
+ io.clone(),
+ input,
+ output,
+ &composer_handle,
+ packages,
+ )?;
}
if input.get_option("root-reqs").as_bool().unwrap_or(false) {
@@ -312,7 +314,7 @@ impl UpdateCommand {
.borrow_mut()
.set_output_progress(!input.get_option("no-progress").as_bool().unwrap_or(false));
- let mut install = Installer::create(io_box.clone(), &composer_handle);
+ let mut install = Installer::create(io.clone(), &composer_handle);
let config = composer.get_config();
let (prefer_source, prefer_dist) =
@@ -432,7 +434,7 @@ impl UpdateCommand {
// set_composer here requires a shared PartialComposer handle.
// bump_command.set_composer(composer);
result = bump_command.do_bump(
- io,
+ io.clone(),
bump_after_update.as_string() == Some("dev"),
bump_after_update.as_string() == Some("no-dev"),
input.get_option("dry-run").as_bool().unwrap_or(false),
@@ -457,7 +459,7 @@ impl UpdateCommand {
/// @return array<string>
fn get_packages_interactively(
&self,
- io: &dyn IOInterface,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
input: &dyn InputInterface,
output: &dyn OutputInterface,
composer: &PartialComposerHandle,