aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/plugin/command_event.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-09 00:09:08 +0900
committernsfisis <nsfisis@gmail.com>2026-06-09 00:09:20 +0900
commit436e12381dd79e419dce755718be17b66d73e17f (patch)
tree09dc809c64efe407b4049695341519ce26c411b3 /crates/shirabe/src/plugin/command_event.rs
parent1c0eb589741de4aa52ef941ff9315b34dbe48aa0 (diff)
downloadphp-shirabe-436e12381dd79e419dce755718be17b66d73e17f.tar.gz
php-shirabe-436e12381dd79e419dce755718be17b66d73e17f.tar.zst
php-shirabe-436e12381dd79e419dce755718be17b66d73e17f.zip
feat(event-dispatcher): unify event dispatch via EventInterface trait
Extract a superclass-trait EventInterface from the base Event. pool_builder's PrePoolCreateEvent stays deferred: its constructor needs owned, non-cloneable Request and repository boxes the builder only holds by reference (owned-payload blocker). The event is plugin-only, so its construction is re-tagged TODO(plugin). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/plugin/command_event.rs')
-rw-r--r--crates/shirabe/src/plugin/command_event.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/shirabe/src/plugin/command_event.rs b/crates/shirabe/src/plugin/command_event.rs
index fc19fcb..ca63461 100644
--- a/crates/shirabe/src/plugin/command_event.rs
+++ b/crates/shirabe/src/plugin/command_event.rs
@@ -1,6 +1,7 @@
//! ref: composer/src/Composer/Plugin/CommandEvent.php
use crate::event_dispatcher::Event;
+use crate::event_dispatcher::EventInterface;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
@@ -57,3 +58,25 @@ impl CommandEvent {
&self.command_name
}
}
+
+impl EventInterface for CommandEvent {
+ fn get_name(&self) -> &str {
+ self.inner.get_name()
+ }
+
+ fn get_arguments(&self) -> &Vec<String> {
+ self.inner.get_arguments()
+ }
+
+ fn get_flags(&self) -> &IndexMap<String, PhpMixed> {
+ self.inner.get_flags()
+ }
+
+ fn is_propagation_stopped(&self) -> bool {
+ self.inner.is_propagation_stopped()
+ }
+
+ fn stop_propagation(&mut self) {
+ self.inner.stop_propagation();
+ }
+}