Refactoring pour tout remettre à la racine car c'est plus pratique
This commit is contained in:
parent
7a92b46df5
commit
3176382386
5 changed files with 21 additions and 28 deletions
|
@ -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
|
||||
}
|
24
src/main.rs
24
src/main.rs
|
@ -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);
|
||||
}
|
||||
|
|
Reference in a new issue