1use std::{error::Error, fmt::Display};
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6#[non_exhaustive]
7#[allow(clippy::module_name_repetitions)]
8pub enum ArgParseError {
9 UnknownFlag(String),
11 MissingValue(String),
13 ConsumedValue(String),
16}
17
18impl Display for ArgParseError {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 match self {
21 Self::UnknownFlag(s) => write!(f, "Unknown flag: `{s}`"),
22 Self::MissingValue(s) => write!(f, "Expected value for `{s}`"),
23 Self::ConsumedValue(s) => write!(
24 f,
25 "Multiple arguments in `{s}` tried to consume the same value"
26 ),
27 }
28 }
29}
30
31impl Error for ArgParseError {}