aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-symfony-console/src/descriptor/descriptor_interface.rs
blob: 928c42940bc72b32dc1fec6f38f81df175a17fb3 (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
28
29
//! ref: composer/vendor/symfony/console/Descriptor/DescriptorInterface.php

use crate::application::Application;
use crate::command::Command;
use crate::input::InputArgument;
use crate::input::InputDefinition;
use crate::input::InputOption;
use crate::output::OutputInterface;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;

/// The set of objects the descriptors know how to describe.
pub enum DescribableObject {
    InputArgument(InputArgument),
    InputOption(InputOption),
    InputDefinition(InputDefinition),
    Command(std::rc::Rc<std::cell::RefCell<dyn Command>>),
    Application(std::rc::Rc<std::cell::RefCell<dyn Application>>),
}

/// Descriptor interface.
pub trait DescriptorInterface {
    fn describe(
        &mut self,
        output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
        object: DescribableObject,
        options: IndexMap<String, PhpMixed>,
    ) -> anyhow::Result<()>;
}