From 802e97387a4b2840723162e9d5d1fbfeb19950e4 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Wed, 10 Apr 2024 09:59:46 +0200 Subject: [PATCH] Ajout : module `error` --- src/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/error.rs diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..7ffec6d --- /dev/null +++ b/src/error.rs @@ -0,0 +1,8 @@ +use std::path::Path; + +pub fn print_error(message: String) { + let name = std::env::args().next().unwrap(); + let name = Path::new(&name).file_name().unwrap().to_str().unwrap(); + + eprintln!("{}: {}", name, message); +}