From 2bf03f066253c5e0997e38d9cecb3d587ad6dff1 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Tue, 9 Apr 2024 17:03:23 +0200 Subject: [PATCH] main : modularisation --- src/main.rs | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1a3aec1..e0c4797 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(); }