Pendragon/src/main.rs

27 lines
480 B
Rust
Raw Normal View History

2024-12-06 14:59:59 +01:00
use std::env;
use std::fs;
2024-12-06 23:43:35 +01:00
2024-12-09 13:19:00 +01:00
mod pendragon;
use pendragon::*;
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 {
2024-12-09 13:19:00 +01:00
eprintln!("Utilisation : pendragon <FILE>");
2024-12-07 10:43:48 +01:00
return
}
let chemin_de_fichier = &arguments[1];
2024-12-09 13:19:00 +01:00
let mut pendragon = Pendragon::new();
2024-12-07 10:43:48 +01:00
match fs::read_to_string(chemin_de_fichier) {
Ok(contenu) => {
2024-12-09 13:19:00 +01:00
let _ = pendragon.execute(contenu);
2024-12-07 10:43:48 +01:00
}
Err(raison) => {
eprintln!("Fichier illisible : {}", raison);
}
}
2024-12-06 23:43:35 +01:00
}