main : inclusion du module parser
; control
: utilisation de la nouvelle structure
This commit is contained in:
parent
dc0e63b8e6
commit
a3b2f3da74
2 changed files with 5 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
use crate::command::{Command, ExitCode, UnixProgram};
|
||||
use crate::command::{Command, ExitCode};
|
||||
use crate::interface::{get_user_input, print_prompt};
|
||||
use crate::parser::parse_command_line;
|
||||
|
||||
fn exit(code: &ExitCode) {
|
||||
let code = i32::from(code.get());
|
||||
|
@ -17,15 +18,9 @@ pub fn run() {
|
|||
|
||||
if user_input.is_some() {
|
||||
let user_input = user_input.unwrap();
|
||||
let command_sequence = parse_command_line(user_input);
|
||||
|
||||
let argv: Vec<String> = user_input
|
||||
.split_whitespace()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
|
||||
if !argv.is_empty() {
|
||||
current_exit_code = UnixProgram::new().argv(argv).spawn();
|
||||
}
|
||||
current_exit_code = command_sequence.spawn();
|
||||
} else {
|
||||
println!();
|
||||
exit(¤t_exit_code);
|
||||
|
|
|
@ -2,6 +2,7 @@ mod command;
|
|||
mod control;
|
||||
mod error;
|
||||
mod interface;
|
||||
mod parser;
|
||||
|
||||
fn main() {
|
||||
control::run();
|
||||
|
|
Loading…
Reference in a new issue