mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
Fix error message typo
This commit is contained in:
parent
864fc1a29b
commit
de28e573d8
22
src/error.rs
22
src/error.rs
@ -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,8 +69,8 @@ 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 => {
|
||||||
write!(f, "{}[ERROR]{} ", colors::red(), colors::reset())?;
|
write!(f, "{}[ERROR]{} ", colors::red(), colors::reset())?;
|
||||||
@ -79,12 +79,16 @@ impl fmt::Display for Error {
|
|||||||
Error::IoError(io_err) => {
|
Error::IoError(io_err) => {
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user