aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/plugin/pre_command_run_event.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/plugin/pre_command_run_event.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/plugin/pre_command_run_event.rs')
-rw-r--r--crates/shirabe/src/plugin/pre_command_run_event.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/crates/shirabe/src/plugin/pre_command_run_event.rs b/crates/shirabe/src/plugin/pre_command_run_event.rs
index 2af2626..21eb232 100644
--- a/crates/shirabe/src/plugin/pre_command_run_event.rs
+++ b/crates/shirabe/src/plugin/pre_command_run_event.rs
@@ -7,14 +7,26 @@ use shirabe_external_packages::symfony::component::console::input::InputInterfac
#[derive(Debug)]
pub struct PreCommandRunEvent {
inner: Event,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
command: String,
}
impl PreCommandRunEvent {
- // TODO(phase-b): input dropped because storing a &dyn reference would need lifetime params.
- pub fn new(name: String, _input: &dyn InputInterface, command: String) -> Self {
+ pub fn new(
+ name: String,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ command: String,
+ ) -> Self {
let inner = Event::new(name, vec![], indexmap::IndexMap::new());
- Self { inner, command }
+ Self {
+ inner,
+ input,
+ command,
+ }
+ }
+
+ pub fn get_input(&self) -> std::rc::Rc<std::cell::RefCell<dyn InputInterface>> {
+ self.input.clone()
}
pub fn get_name(&self) -> &str {