aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/io/null_io.rs
blob: 4218398819beee0325bc15329dcb9c592fd10f48 (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
75
76
77
78
79
80
81
//! ref: composer/src/Composer/IO/NullIO.php

use crate::io::base_io::BaseIO;
use crate::io::io_interface::IOInterface;
use shirabe_php_shim::PhpMixed;

#[derive(Debug)]
pub struct NullIO {
    inner: BaseIO,
}

impl IOInterface for NullIO {
    fn is_interactive(&self) -> bool {
        false
    }

    fn is_verbose(&self) -> bool {
        false
    }

    fn is_very_verbose(&self) -> bool {
        false
    }

    fn is_debug(&self) -> bool {
        false
    }

    fn is_decorated(&self) -> bool {
        false
    }

    fn write(&self, _messages: PhpMixed, _newline: bool, _verbosity: i64) {}

    fn write_error(&self, _messages: PhpMixed, _newline: bool, _verbosity: i64) {}

    fn overwrite(&self, _messages: PhpMixed, _newline: bool, _size: Option<i64>, _verbosity: i64) {}

    fn overwrite_error(
        &self,
        _messages: PhpMixed,
        _newline: bool,
        _size: Option<i64>,
        _verbosity: i64,
    ) {
    }

    fn ask(&self, _question: String, default: PhpMixed) -> PhpMixed {
        default
    }

    fn ask_confirmation(&self, _question: String, default: bool) -> bool {
        default
    }

    fn ask_and_validate(
        &self,
        _question: String,
        _validator: Box<dyn Fn(PhpMixed) -> PhpMixed>,
        _attempts: Option<i64>,
        default: PhpMixed,
    ) -> PhpMixed {
        default
    }

    fn ask_and_hide_answer(&self, _question: String) -> Option<String> {
        None
    }

    fn select(
        &self,
        _question: String,
        _choices: Vec<String>,
        default: PhpMixed,
        _attempts: PhpMixed,
        _error_message: String,
        _multiselect: bool,
    ) -> PhpMixed {
        default
    }
}