aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-16 00:33:52 +0900
committernsfisis <nsfisis@gmail.com>2026-05-16 10:00:40 +0900
commite61b6e8dbc161644b604b02d375b91205e050497 (patch)
treea14d72293b4f4d02e2ef39bb1a798701cda77ba4 /crates
parent3f08ac80557400be0352fc62b146bb9a4f95c575 (diff)
downloadphp-shirabe-e61b6e8dbc161644b604b02d375b91205e050497.tar.gz
php-shirabe-e61b6e8dbc161644b604b02d375b91205e050497.tar.zst
php-shirabe-e61b6e8dbc161644b604b02d375b91205e050497.zip
feat(port): port IOInterface.php
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe/src/io/io_interface.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/crates/shirabe/src/io/io_interface.rs b/crates/shirabe/src/io/io_interface.rs
index 0389b9a..1a6eb3f 100644
--- a/crates/shirabe/src/io/io_interface.rs
+++ b/crates/shirabe/src/io/io_interface.rs
@@ -1 +1,56 @@
//! ref: composer/src/Composer/IO/IOInterface.php
+
+use indexmap::IndexMap;
+use shirabe_php_shim::PhpMixed;
+use shirabe_external_packages::psr::log::logger_interface::LoggerInterface;
+use crate::config::Config;
+
+pub trait IOInterface: LoggerInterface {
+ const QUIET: i64 = 1;
+ const NORMAL: i64 = 2;
+ const VERBOSE: i64 = 4;
+ const VERY_VERBOSE: i64 = 8;
+ const DEBUG: i64 = 16;
+
+ fn is_interactive(&self) -> bool;
+
+ fn is_verbose(&self) -> bool;
+
+ fn is_very_verbose(&self) -> bool;
+
+ fn is_debug(&self) -> bool;
+
+ fn is_decorated(&self) -> bool;
+
+ fn write(&self, messages: PhpMixed, newline: bool, verbosity: i64);
+
+ fn write_error(&self, messages: PhpMixed, newline: bool, verbosity: i64);
+
+ fn write_raw(&self, messages: PhpMixed, newline: bool, verbosity: i64);
+
+ fn write_error_raw(&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;
+
+ fn ask_confirmation(&self, question: String, default: bool) -> bool;
+
+ fn ask_and_validate(&self, question: String, validator: Box<dyn Fn(PhpMixed) -> PhpMixed>, attempts: Option<i64>, default: PhpMixed) -> PhpMixed;
+
+ fn ask_and_hide_answer(&self, question: String) -> Option<String>;
+
+ fn select(&self, question: String, choices: Vec<String>, default: PhpMixed, attempts: PhpMixed, error_message: String, multiselect: bool) -> PhpMixed;
+
+ fn get_authentications(&self) -> IndexMap<String, IndexMap<String, Option<String>>>;
+
+ fn has_authentication(&self, repository_name: &str) -> bool;
+
+ fn get_authentication(&self, repository_name: &str) -> IndexMap<String, Option<String>>;
+
+ fn set_authentication(&self, repository_name: String, username: String, password: Option<String>);
+
+ fn load_configuration(&self, config: &Config);
+}