From 9761556033c1faaae37f995ba557c47f9f3c357f Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Sat, 25 Mar 2023 12:35:11 +0200 Subject: Identify where the current code needs the dirs to exist --- src/lib.rs | 2 ++ src/main.rs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 595e3ec..5e33302 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,4 +41,6 @@ pub enum ShackleError { UserReadError, #[error("Path is not accessible")] InvalidDirectory, + #[error("`{0}`")] + CustomError(String), } diff --git a/src/main.rs b/src/main.rs index 4333866..d7a633f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,14 @@ struct Args { command: Option, } -fn main() -> Result<(), ShackleError> { +fn main() { + if let Err(e) = main_inner() { + eprintln!("{}", e); + std::process::exit(1); + } +} + +fn main_inner() -> Result<(), ShackleError> { let args = Args::parse(); match args.command { Some(user_input) => { -- cgit v1.2.3