From 40410840c9dfad331689b79894d813586969e472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Rodrigues=20Miguel?= Date: Wed, 6 Oct 2021 15:54:43 -0300 Subject: [PATCH] error: add `MissingArgumentsForDecompression` --- src/cli.rs | 2 +- src/error.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 0cde41f..9ff64c6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -125,7 +125,7 @@ pub fn parse_args_from(mut args: Vec) -> crate::Result { return Err(Error::CompressionTypo); } } else { - todo!("Complain that no decompression arguments were given."); + return Err(Error::MissingArgumentsForDecompression); } // Parse flags diff --git a/src/error.rs b/src/error.rs index 0169fed..45beaae 100644 --- a/src/error.rs +++ b/src/error.rs @@ -27,6 +27,7 @@ pub enum Error { OofError(oof::OofError), CompressingRootFolder, MissingArgumentsForCompression, + MissingArgumentsForDecompression, CompressionTypo, WalkdirError { reason: String }, } @@ -130,6 +131,17 @@ impl fmt::Display for Error { error } + Error::MissingArgumentsForDecompression => { + let error = FinalError::with_title("Could not decompress") + .detail("The compress command requires at least one argument") + .hint("You must provide:") + .hint(" - At least one input argument.") + .hint("") + .hint("Example: `ouch decompress imgs.tar.gz`") + .to_owned(); + + error + } Error::InternalError => { let error = FinalError::with_title("InternalError :(") .detail("This should not have happened")