added interactive inputs, better error messages, bugfixes

This commit is contained in:
2025-11-03 20:55:45 +01:00
parent 2336ce0325
commit d289cff56c
17 changed files with 955 additions and 55 deletions

37
src/error/colors.rs Normal file
View File

@@ -0,0 +1,37 @@
pub struct Colors;
impl Colors {
pub const RESET: &'static str = "\x1b[0m";
pub const BOLD: &'static str = "\x1b[1m";
pub const RED: &'static str = "\x1b[31m";
pub const GREEN: &'static str = "\x1b[32m";
pub const YELLOW: &'static str = "\x1b[33m";
pub const BLUE: &'static str = "\x1b[34m";
pub const MAGENTA: &'static str = "\x1b[35m";
pub const CYAN: &'static str = "\x1b[36m";
pub const BOLD_RED: &'static str = "\x1b[1;31m";
pub const BOLD_YELLOW: &'static str = "\x1b[1;33m";
pub const BOLD_CYAN: &'static str = "\x1b[1;36m";
}
pub fn error(msg: &str) -> String {
format!("{}{}ERROR:{} {}", Colors::BOLD_RED, Colors::BOLD, Colors::RESET, msg)
}
pub fn warning(msg: &str) -> String {
format!("{}{}WARNING:{} {}", Colors::BOLD_YELLOW, Colors::BOLD, Colors::RESET, msg)
}
pub fn info(msg: &str) -> String {
format!("{}{}INFO:{} {}", Colors::BOLD_CYAN, Colors::BOLD, Colors::RESET, msg)
}
pub fn location(file: &str, line: usize) -> String {
format!("{}{}:{}{}", Colors::CYAN, file, line, Colors::RESET)
}
pub fn highlight(text: &str) -> String {
format!("{}{}{}", Colors::YELLOW, text, Colors::RESET)
}