feature/error_handling #8

Merged
ahurac merged 3 commits from feature/error_handling into main 2023-12-13 19:45:02 +01:00
Showing only changes of commit b0a89b688f - Show all commits

View file

@ -1,7 +1,14 @@
use std::env;
use std::path::Path;
fn error(message: &str) {
eprintln!("{}: {}", env::args().next().unwrap(), message);
let argv0: String = env::args().next().unwrap();
let program_name = Path::new(&argv0)
.file_name()
.unwrap()
.to_str()
.unwrap();
eprintln!("{}: {}", program_name, message);
}
pub fn command_not_found(command: &String) -> i32 {