Fix error message typo

This commit is contained in:
João M. Bezerra 2021-05-15 01:13:40 -03:00
parent 864fc1a29b
commit de28e573d8

View File

@ -1,5 +1,5 @@
use std::{fmt, path::PathBuf};
use crate::utils::colors;
use std::{fmt, path::PathBuf};
pub enum Error {
UnknownExtensionError(String),
@ -69,8 +69,8 @@ impl fmt::Display for Error {
write!(f, "{}[ERROR]{} ", colors::red(), colors::reset())?;
let spacing = " ";
writeln!(f,"The compress subcommands demands at least 2 arguments, an input file and an output file.")?;
writeln!(f,"{}Example: `ouch compress img.jpeg img.zip", spacing)?;
write!(f,"{}For more information, run `ouch --help`", spacing)
writeln!(f, "{}Example: `ouch compress img.jpeg img.zip`", spacing)?;
write!(f, "{}For more information, run `ouch --help`", spacing)
}
Error::InternalError => {
write!(f, "{}[ERROR]{} ", colors::red(), colors::reset())?;
@ -79,12 +79,16 @@ impl fmt::Display for Error {
Error::IoError(io_err) => {
write!(f, "{}[ERROR]{} {}", colors::red(), colors::reset(), io_err)
}
Error::CompressionTypo =>{
write!(f, "Did you mean {}ouch compress{}?", colors::magenta(), colors::reset())
Error::CompressionTypo => {
write!(
f,
"Did you mean {}ouch compress{}?",
colors::magenta(),
colors::reset()
)
}
_err => {
// TODO
write!(f, "")
todo!();
}
}
}
@ -96,9 +100,7 @@ impl From<std::io::Error> for Error {
std::io::ErrorKind::NotFound => panic!("{}", err),
std::io::ErrorKind::PermissionDenied => Self::PermissionDenied,
std::io::ErrorKind::AlreadyExists => Self::AlreadyExists,
_other => {
Self::IoError(err)
}
_other => Self::IoError(err),
}
}
}