fix(TimeMetrics Struct): parser of time metric from command argument

This commit is contained in:
doryan 2024-06-18 18:15:10 +04:00
parent c76364c8b4
commit da5edc1aac

View File

@ -11,7 +11,7 @@ pub enum TimeMetrics {
impl TimeMetrics {
pub fn from(metric: impl Into<&'static str>, duration: i64) -> Self {
match metric.into() {
"min" | "minutes" | "minute" | "минута" | "минуты" | "минут" | "мин" => {
"m" | "min" | "minutes" | "minute" | "минута" | "минуты" | "минут" | "мин" | "м" => {
Self::Minutes(duration)
}
"h" | "hours" | "hour" | "час" | "часов" | "ч" => Self::Hours(duration),
@ -21,7 +21,7 @@ impl TimeMetrics {
"w" | "weeks" | "week" | "недель" | "недели" | "неделя" | "н" => {
Self::Weeks(duration)
}
"m" | "months" | "month" | "месяц" | "месяца" | "месяцев" | "мес" => {
"M" | "months" | "month" | "месяц" | "месяца" | "месяцев" | "мес" | "М" => {
Self::Mounths(duration)
}
_ => Self::Days(duration),