aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/command/exec_command.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-06 18:04:45 +0900
committernsfisis <nsfisis@gmail.com>2026-06-06 18:04:45 +0900
commitd5b313f388d424e60ae33ae58c1a65a65b24b8f1 (patch)
tree849ada9b7319b8eb85aab28e02f614023fea2105 /crates/shirabe/src/command/exec_command.rs
parent71b432db3f115d17be498f36cd3efd40b4650a0b (diff)
downloadphp-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/exec_command.rs')
-rw-r--r--crates/shirabe/src/command/exec_command.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs
index cfc0e89..b086937 100644
--- a/crates/shirabe/src/command/exec_command.rs
+++ b/crates/shirabe/src/command/exec_command.rs
@@ -41,16 +41,16 @@ impl ExecCommand {
pub fn interact(
&mut self,
- input: &mut dyn InputInterface,
- _output: &dyn OutputInterface,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> Result<()> {
let binaries = self.get_binaries(false)?;
if binaries.is_empty() {
return Ok(());
}
- if input.get_argument("binary").as_string().is_some()
- || input.get_option("list").as_bool().unwrap_or(false)
+ if input.borrow().get_argument("binary").as_string().is_some()
+ || input.borrow().get_option("list").as_bool().unwrap_or(false)
{
return Ok(());
}
@@ -66,7 +66,7 @@ impl ExecCommand {
);
if let Some(idx) = binary.as_int() {
- input.set_argument(
+ input.borrow_mut().set_argument(
"binary",
shirabe_php_shim::PhpMixed::String(binaries[idx as usize].clone()),
);
@@ -77,13 +77,13 @@ impl ExecCommand {
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)?;
- if input.get_option("list").as_bool().unwrap_or(false)
- || input.get_argument("binary").as_string().is_none()
+ if input.borrow().get_option("list").as_bool().unwrap_or(false)
+ || input.borrow().get_argument("binary").as_string().is_none()
{
let bins = self.get_binaries(true)?;
if bins.is_empty() {
@@ -114,6 +114,7 @@ impl ExecCommand {
}
let binary = input
+ .borrow()
.get_argument("binary")
.as_string()
.unwrap_or("")
@@ -139,6 +140,7 @@ impl ExecCommand {
}
let args = input
+ .borrow()
.get_argument("args")
.as_list()
.map(|l| {