error: add MissingArgumentsForDecompression

This commit is contained in:
Vinícius Rodrigues Miguel 2021-10-06 15:54:43 -03:00
parent 990458b771
commit 40410840c9
2 changed files with 13 additions and 1 deletions

View File

@ -125,7 +125,7 @@ pub fn parse_args_from(mut args: Vec<OsString>) -> crate::Result<ParsedArgs> {
return Err(Error::CompressionTypo);
}
} else {
todo!("Complain that no decompression arguments were given.");
return Err(Error::MissingArgumentsForDecompression);
}
// Parse flags

View File

@ -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")