Refactoring pour tout remettre à la racine car c'est plus pratique

This commit is contained in:
Hippolyte Chauvin 2023-11-01 14:48:13 +01:00
parent 7a92b46df5
commit 3176382386
5 changed files with 21 additions and 28 deletions

View file

@ -1,25 +0,0 @@
mod r#in;
mod r#out;
mod parser;
pub fn run() -> i32 {
let mut buffer = r#in::Buffer::new();
let mut bytes_read: usize = 1;
let mut command_line: String;
let mut argv: Vec<String>;
while bytes_read != 0 {
out::print_ps1();
bytes_read = buffer.read_line();
if ! buffer.is_empty() {
command_line = buffer.get_buffer().to_string();
argv = parser::parse(&command_line);
println!("{:?}", argv);
}
}
println!();
0
}

View file

@ -1,9 +1,27 @@
use std::process::exit;
mod io;
mod input;
mod output;
mod parser;
fn main() {
let last_exit_code: i32 = io::run();
let mut buffer = input::Buffer::new();
let mut bytes_read: usize = 1;
let mut command_line: String;
let mut argv: Vec<String>;
exit(last_exit_code);
while bytes_read != 0 {
output::print_ps1();
bytes_read = buffer.read_line();
if ! buffer.is_empty() {
command_line = buffer.get_buffer().to_string();
argv = parser::parse(&command_line);
println!("{:?}", argv);
}
}
println!();
exit(0);
}