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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
//! ref: composer/src/Composer/IO/NullIO.php
use crate::io::base_io::BaseIO;
use crate::io::io_interface::IOInterface;
use shirabe_external_packages::psr::log::logger_interface::LoggerInterface;
use shirabe_php_shim::PhpMixed;
#[derive(Debug)]
pub struct NullIO {
authentications: indexmap::IndexMap<String, indexmap::IndexMap<String, Option<String>>>,
}
impl NullIO {
pub fn new() -> Self {
Self {
authentications: indexmap::IndexMap::new(),
}
}
}
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 write3(&mut self, _message: &str, _newline: bool, _verbosity: i64) {}
fn write_error3(&mut self, _message: &str, _newline: bool, _verbosity: i64) {}
fn write_raw3(&mut self, _message: &str, _newline: bool, _verbosity: i64) {}
fn write_error_raw3(&mut self, _message: &str, _newline: bool, _verbosity: i64) {}
fn overwrite4(&mut self, _message: &str, _newline: bool, _size: Option<i64>, _verbosity: i64) {}
fn overwrite_error4(
&mut self,
_message: &str,
_newline: bool,
_size: Option<i64>,
_verbosity: i64,
) {
}
fn ask(&mut self, _question: String, default: PhpMixed) -> PhpMixed {
default
}
fn ask_confirmation(&mut self, _question: String, default: bool) -> bool {
default
}
fn ask_and_validate(
&mut self,
_question: String,
_validator: Box<dyn Fn(PhpMixed) -> PhpMixed>,
_attempts: Option<i64>,
default: PhpMixed,
) -> PhpMixed {
default
}
fn ask_and_hide_answer(&mut self, _question: String) -> Option<String> {
None
}
fn select(
&mut self,
_question: String,
_choices: Vec<String>,
default: PhpMixed,
_attempts: PhpMixed,
_error_message: String,
_multiselect: bool,
) -> PhpMixed {
default
}
fn get_authentications(
&self,
) -> indexmap::IndexMap<String, indexmap::IndexMap<String, Option<String>>> {
<Self as BaseIO>::get_authentications(self)
}
fn has_authentication(&self, repository_name: &str) -> bool {
<Self as BaseIO>::has_authentication(self, repository_name)
}
fn get_authentication(
&self,
repository_name: &str,
) -> indexmap::IndexMap<String, Option<String>> {
<Self as BaseIO>::get_authentication(self, repository_name)
}
fn set_authentication(
&mut self,
repository_name: String,
username: String,
password: Option<String>,
) {
<Self as BaseIO>::set_authentication(self, repository_name, username, password)
}
fn load_configuration(&mut self, config: &mut crate::config::Config) -> anyhow::Result<()> {
<Self as BaseIO>::load_configuration(self, config)
}
}
impl BaseIO for NullIO {
fn authentications(
&self,
) -> &indexmap::IndexMap<String, indexmap::IndexMap<String, Option<String>>> {
&self.authentications
}
fn authentications_mut(
&mut self,
) -> &mut indexmap::IndexMap<String, indexmap::IndexMap<String, Option<String>>> {
&mut self.authentications
}
}
impl LoggerInterface for NullIO {
fn emergency(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn alert(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn critical(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn error(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn warning(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn notice(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn info(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn debug(&self, message: &str, context: &[(&str, &str)]) {
todo!()
}
fn log(&self, level: &str, message: &str, context: &[(&str, &str)]) {
todo!()
}
}
|