Files
FoundryOS/libk/src/util/shell.rs
T
2025-02-27 01:16:07 +00:00

50 lines
2.0 KiB
Rust

// use x86_64::registers::rflags::read;
use alloc::vec::Vec;
use crate::{
drivers::io::ascii::clear_screen, prelude::stdin::read_line, print, println,
std::application::Application, util::editor::Editor,
};
static FETCH: &str = "
$$$$$$$$\\ $$\\
$$ _____| $$ |
$$ | $$$$$$\\ $$\\ $$\\ $$$$$$$\\ $$$$$$$ | $$$$$$\\ $$\\ $$\\
$$$$$\\ $$ __$$\\ $$ | $$ |$$ __$$\\ $$ __$$ |$$ __$$\\ $$ | $$ |
$$ __|$$ / $$ |$$ | $$ |$$ | $$ |$$ / $$ |$$ | \\__|$$ | $$ |
$$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$ |
$$ | \\$$$$$$ |\\$$$$$$ |$$ | $$ |\\$$$$$$$ |$$ | \\$$$$$$$ |
\\__| \\______/ \\______/ \\__| \\__| \\_______|\\__| \\____$$ |
$$$$$$\\ $$$$$$\\ $$\\ $$\\ $$\\ $$\\ $$ |
$$ __$$\\ $$ __$$\\ $$ | $$ |$$$$ | \\$$$$$$ |
$$ / $$ |$$ / \\__| $$ | $$ |\\_$$ | \\______/
$$ | $$ |\\$$$$$$\\ \\$$\\ $$ | $$ |
$$ | $$ | \\____$$\\ \\$$\\$$ / $$ |
$$ | $$ |$$\\ $$ | \\$$$ / $$ |
$$$$$$ |\\$$$$$$ | \\$ / $$$$$$\\
\\______/ \\______/ \\_/ \\______|
";
pub async fn shell() {
println!("{}", FETCH);
loop {
print!(" Shell> ");
let line = read_line().await;
match line.as_str() {
"fetch" => {
println!("{}", FETCH);
}
"editor" => {
let mut editor = Editor::new();
editor.run(Vec::new()).await.unwrap();
}
"clear" => clear_screen(),
_ => {
println!("Unknown command: {}", line);
}
}
}
}