parse_calendar_event: support the weekly special expression

While we do not yet support the date specs for CalendarEvent the left
out "weekly" special expression[0] dies not requires that support.
It is specified to be equivalent with `Mon *-*-* 00:00:00` [0] and
this can be implemented with the weekday and time support we already
have.

[0]: https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-21 13:24:48 +02:00
parent a26c27c8e6
commit 956295cefe

View File

@ -219,7 +219,16 @@ fn parse_calendar_event_incomplete(mut i: &str) -> IResult<&str, CalendarEvent>
..Default::default()
}));
}
"monthly" | "weekly" | "yearly" | "quarterly" | "semiannually" => {
"weekly" => {
return Ok(("", CalendarEvent {
hour: vec![DateTimeValue::Single(0)],
minute: vec![DateTimeValue::Single(0)],
second: vec![DateTimeValue::Single(0)],
days: WeekDays::MONDAY,
..Default::default()
}));
}
"monthly" | "yearly" | "quarterly" | "semiannually" => {
return Err(parse_error(i, "unimplemented date or time specification"));
}
_ => { /* continue */ }