implemented stdin methods for reading a string (async) and reading keystrokes (sync + async). added a very basic shell on top of it for debugging

This commit is contained in:
2025-02-25 02:16:01 +00:00
parent 00d3a1de72
commit 27ee8226d8
7 changed files with 133 additions and 75 deletions
+40
View File
@@ -0,0 +1,40 @@
use x86_64::registers::rflags::read;
use crate::{drivers::io::ascii::clear_screen, prelude::stdin::read_line, print, println};
static FETCH: &str = "
$$$$$$$$\\ $$\\
$$ _____| $$ |
$$ | $$$$$$\\ $$\\ $$\\ $$$$$$$\\ $$$$$$$ | $$$$$$\\ $$\\ $$\\
$$$$$\\ $$ __$$\\ $$ | $$ |$$ __$$\\ $$ __$$ |$$ __$$\\ $$ | $$ |
$$ __|$$ / $$ |$$ | $$ |$$ | $$ |$$ / $$ |$$ | \\__|$$ | $$ |
$$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$ |
$$ | \\$$$$$$ |\\$$$$$$ |$$ | $$ |\\$$$$$$$ |$$ | \\$$$$$$$ |
\\__| \\______/ \\______/ \\__| \\__| \\_______|\\__| \\____$$ |
$$$$$$\\ $$$$$$\\ $$\\ $$\\ $$\\ $$\\ $$ |
$$ __$$\\ $$ __$$\\ $$ | $$ |$$$$ | \\$$$$$$ |
$$ / $$ |$$ / \\__| $$ | $$ |\\_$$ | \\______/
$$ | $$ |\\$$$$$$\\ \\$$\\ $$ | $$ |
$$ | $$ | \\____$$\\ \\$$\\$$ / $$ |
$$ | $$ |$$\\ $$ | \\$$$ / $$ |
$$$$$$ |\\$$$$$$ | \\$ / $$$$$$\\
\\______/ \\______/ \\_/ \\______|
";
pub async fn shell() {
println!("{}", FETCH);
loop {
print!(" Shell> ");
let line = read_line().await;
match line.as_str() {
"fetch" => {
println!("{}", FETCH);
}
"clear" => clear_screen(),
_ => {
println!("Unknown command: {}", line);
}
}
}
}