X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323..edcd0e51b3e0a6d52a560f293b7e6a08999cfd0c:/src/main.rs?ds=sidebyside diff --git a/src/main.rs b/src/main.rs index 8867dc0..a5c2cf6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,22 @@ use command::{available_commands, Command, help::Help}; use configuration::Configuration; fn main() -> Result<()> { + let result = run(); + + if cfg!(debug_assertions) { + result + } else { + match result { + Ok(_) => Ok(()), + Err(e) => { + eprintln!("Error: {}", e); + std::process::exit(1); + } + } + } +} + +fn run() -> Result<()> { let configuration = Configuration::new(); let commands = available_commands(); let arguments: Vec = args().collect();