2024-12-06 14:59:59 +01:00
|
|
|
use std::env;
|
|
|
|
use std::fs;
|
2024-12-06 23:43:35 +01:00
|
|
|
|
2024-12-08 15:59:26 +01:00
|
|
|
mod sophie;
|
|
|
|
use sophie::*;
|
2024-12-08 15:45:49 +01:00
|
|
|
|
2024-12-07 10:43:48 +01:00
|
|
|
fn main() {
|
|
|
|
let arguments: Vec<String> = env::args().collect();
|
|
|
|
|
|
|
|
if arguments.len() < 2 {
|
|
|
|
eprintln!("Utilisation : sophie <FILE>");
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
let chemin_de_fichier = &arguments[1];
|
|
|
|
let mut sophie = Sophie::new();
|
|
|
|
|
|
|
|
match fs::read_to_string(chemin_de_fichier) {
|
|
|
|
Ok(contenu) => {
|
2024-12-08 21:52:00 +01:00
|
|
|
let _ = sophie.execute(contenu);
|
2024-12-07 10:43:48 +01:00
|
|
|
}
|
|
|
|
Err(raison) => {
|
|
|
|
eprintln!("Fichier illisible : {}", raison);
|
|
|
|
}
|
|
|
|
}
|
2024-12-06 23:43:35 +01:00
|
|
|
}
|