|
|
|
@ -17,6 +17,7 @@ pub enum ParseErrorKind
|
|
|
|
|
CannotCombine(char, char),
|
|
|
|
|
BadTail(char, String),
|
|
|
|
|
NotUnique(char),
|
|
|
|
|
NotUniqueLong(Option<String>),
|
|
|
|
|
ModeSet,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -26,7 +27,20 @@ impl fmt::Display for ParseErrorKind
|
|
|
|
|
{
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|
|
{
|
|
|
|
|
Ok(())
|
|
|
|
|
match self {
|
|
|
|
|
Self::ExpectedArg(arg) => write!(f, "expected argument {:?}", arg),
|
|
|
|
|
Self::UnexpectedArg(None) => write!(f, "unknown argument"),
|
|
|
|
|
Self::UnexpectedArg(Some(arg)) => write!(f, "argument {:?} not expected here", arg),
|
|
|
|
|
Self::UnknownOption(ch) => write!(f, "unknown option `{}`", ch),
|
|
|
|
|
Self::UnknownKeyFormat(key) => write!(f, "unknown key format for {}", key),
|
|
|
|
|
Self::UnknownOptionFor(fo, o) => write!(f, "unknown option `{}` for `{}`", o, fo),
|
|
|
|
|
Self::CannotCombine(o1,o2) => write!(f, "cannot combine option `{}` with `{}`", o2, o1),
|
|
|
|
|
Self::BadTail(ch, ret) => write!(f, "unexpected tail {:?} for option `{}`", ret, ch),
|
|
|
|
|
Self::NotUnique(o) => write!(f, "option `{}` already specified", o),
|
|
|
|
|
Self::NotUniqueLong(None) => write!(f, "argument already specified"),
|
|
|
|
|
Self::NotUniqueLong(Some(opt)) => write!(f, "option {:?} already specified", opt),
|
|
|
|
|
Self::ModeSet => write!(f, "mode already set"),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -62,7 +76,10 @@ impl fmt::Display for ConstructError
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|
|
{
|
|
|
|
|
match self {
|
|
|
|
|
_ => write!(f, "unknown error"),
|
|
|
|
|
Self::NoGenerateKind => write!(f, "no key kind specified"),
|
|
|
|
|
Self::ExpectedNotPresent(name) => write!(f, "expected a {}, one was not provided", name),
|
|
|
|
|
Self::AlreadyExists(opt) => write!(f, "duplicate atom {}", opt),
|
|
|
|
|
Self::Resolve(_) => write!(f, "error resolving autodetect"),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -92,6 +109,9 @@ impl fmt::Display for Error
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|
|
{
|
|
|
|
|
match self {
|
|
|
|
|
Error::Parse(arg, _) => write!(f, "error while parsing arg {:?}", arg),
|
|
|
|
|
Error::ExpectedKind(Some(got)) => write!(f, r#"expected a key kind ("AES" or "RSA"), got {:?}"#, got),
|
|
|
|
|
Error::ExpectedKind(None) => write!(f, "expected a key kind"),
|
|
|
|
|
Error::AtomInternal => unreachable!("This should've been handled."),
|
|
|
|
|
_ => write!(f, "unknown error"),
|
|
|
|
|
}
|
|
|
|
|