mirror of
https://github.com/eza-community/eza
synced 2024-10-06 16:09:06 +00:00
use match for timeformat-parsing
This commit is contained in:
parent
4911ac6714
commit
1b54874ce8
|
@ -14,7 +14,7 @@ pub enum OptionsError {
|
||||||
Parse(ParseError),
|
Parse(ParseError),
|
||||||
|
|
||||||
/// The user supplied an illegal choice to an Argument.
|
/// The user supplied an illegal choice to an Argument.
|
||||||
BadArgument(&'static Arg, OsString),
|
BadArgument(&'static Arg, String),
|
||||||
|
|
||||||
/// The user supplied a set of options that are unsupported
|
/// The user supplied a set of options that are unsupported
|
||||||
Unsupported(String),
|
Unsupported(String),
|
||||||
|
|
|
@ -254,23 +254,14 @@ impl TimeFormat {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if &word == "default" {
|
let word = word.to_string_lossy();
|
||||||
Ok(Self::DefaultFormat)
|
match word.as_ref() {
|
||||||
}
|
"default" => Ok(Self::DefaultFormat),
|
||||||
else if &word == "relative" {
|
"relative" => Ok(Self::Relative),
|
||||||
Ok(Self::Relative)
|
"iso" => Ok(Self::ISOFormat),
|
||||||
}
|
"long-iso" => Ok(Self::LongISO),
|
||||||
else if &word == "iso" {
|
"full-iso" => Ok(Self::FullISO),
|
||||||
Ok(Self::ISOFormat)
|
_ => Err(OptionsError::BadArgument(&flags::TIME_STYLE, word.to_string()))
|
||||||
}
|
|
||||||
else if &word == "long-iso" {
|
|
||||||
Ok(Self::LongISO)
|
|
||||||
}
|
|
||||||
else if &word == "full-iso" {
|
|
||||||
Ok(Self::FullISO)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Err(OptionsError::BadArgument(&flags::TIME_STYLE, word))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue