aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/symfony/console/style/style_interface.rs
blob: 96745de1ad8fc10b94c6f052bd659c3fc9c1ab96 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! ref: composer/vendor/symfony/console/Style/StyleInterface.php

use shirabe_php_shim::PhpMixed;

/// Output style helpers.
pub trait StyleInterface {
    /// Formats a command title.
    fn title(&mut self, message: &str);

    /// Formats a section title.
    fn section(&mut self, message: &str);

    /// Formats a list.
    fn listing(&mut self, elements: Vec<PhpMixed>);

    /// Formats informational text.
    fn text(&mut self, message: PhpMixed);

    /// Formats a success result bar.
    fn success(&mut self, message: PhpMixed);

    /// Formats an error result bar.
    fn error(&mut self, message: PhpMixed);

    /// Formats an warning result bar.
    fn warning(&mut self, message: PhpMixed);

    /// Formats a note admonition.
    fn note(&mut self, message: PhpMixed);

    /// Formats a caution admonition.
    fn caution(&mut self, message: PhpMixed);

    /// Formats a table.
    fn table(&mut self, headers: Vec<PhpMixed>, rows: Vec<PhpMixed>);

    /// Asks a question.
    fn ask(
        &mut self,
        question: &str,
        default: Option<&str>,
        validator: Option<Box<dyn Fn(Option<PhpMixed>) -> anyhow::Result<PhpMixed>>>,
    ) -> PhpMixed;

    /// Asks a question with the user input hidden.
    fn ask_hidden(
        &mut self,
        question: &str,
        validator: Option<Box<dyn Fn(Option<PhpMixed>) -> anyhow::Result<PhpMixed>>>,
    ) -> PhpMixed;

    /// Asks for confirmation.
    fn confirm(&mut self, question: &str, default: bool) -> bool;

    /// Asks a choice question.
    fn choice(
        &mut self,
        question: &str,
        choices: Vec<PhpMixed>,
        default: Option<PhpMixed>,
    ) -> PhpMixed;

    /// Add newline(s).
    fn new_line(&mut self, count: i64);

    /// Starts the progress output.
    fn progress_start(&mut self, max: i64);

    /// Advances the progress output X steps.
    fn progress_advance(&mut self, step: i64);

    /// Finishes the progress output.
    fn progress_finish(&mut self);
}