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