Skip to content

Commit

Permalink
error: add MissingArgumentsForDecompression
Browse files Browse the repository at this point in the history
  • Loading branch information
vrmiguel committed Oct 6, 2021
1 parent 990458b commit 4041084
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum Error {
OofError(oof::OofError),
CompressingRootFolder,
MissingArgumentsForCompression,
MissingArgumentsForDecompression,
CompressionTypo,
WalkdirError { reason: String },
}
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 4041084

Please sign in to comment.