aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/plugin/pre_command_run_event.rs
blob: a3da4f7c2d69b05b3068a1f78c9b894c1a7a552f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//! ref: composer/src/Composer/Plugin/PreCommandRunEvent.php

// TODO(plugin): this event is part of the plugin API and is dispatched before a command runs
use crate::event_dispatcher::event::Event;
use shirabe_external_packages::symfony::component::console::input::input_interface::InputInterface;

#[derive(Debug)]
pub struct PreCommandRunEvent {
    inner: Event,
    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 {
        let inner = Event::new(name, vec![], indexmap::IndexMap::new());
        Self { inner, command }
    }

    pub fn get_name(&self) -> &str {
        self.inner.get_name()
    }

    pub fn get_command(&self) -> &str {
        &self.command
    }
}