main : modularisation

This commit is contained in:
Ahurac 2024-04-09 17:03:23 +02:00
parent c55268e0a9
commit 2bf03f0662

View file

@ -1,31 +1,7 @@
use std::io;
use std::io::Write;
fn exit() {
println!("exit");
std::process::exit(0);
}
mod command;
mod control;
mod interface;
fn main() {
let mut user_input = String::new();
let mut bytes_read;
loop {
print!("$ ");
io::stdout().flush().unwrap();
user_input.clear();
bytes_read = io::stdin()
.read_line(&mut user_input)
.expect("error reading user input");
if bytes_read == 0 {
println!();
exit();
} else {
let user_input = user_input.trim();
println!("{}", user_input);
}
}
control::run();
}