feat(remind): add calendar source to rendered reminders

This commit is contained in:
2026-05-17 00:33:02 +02:00
parent fafdd8c142
commit 35eb2b99e2

View File

@@ -55,6 +55,7 @@ let empty =
let add_rem b = Buffer.add_string b "REM "
let add_info b uuid = Buffer.add_string b (spf "INFO \"UID: %s\" " uuid)
let add_source b source = Buffer.add_string b (spf "INFO \"Calendar: %s\" " (String.uppercase_ascii source))
let add_date b date = Buffer.add_string b (Timedesc.Date.to_rfc3339 date)
let add_weekday b wd = Buffer.add_string b (spf "%s " (string_of_weekday wd))
@@ -115,6 +116,7 @@ let render_daily rem (d : simple_daily) =
let b = Buffer.create 256 in
add_rem b;
add_info b rem.original_uuid;
add_source b rem.source;
add_date b rem.date;
Buffer.add_char b ' ';
add_interval_daily b d;
@@ -130,6 +132,7 @@ let render_weekly rem (w : simple_weekly) =
(fun wd ->
add_rem b;
add_info b rem.original_uuid;
add_source b rem.source;
add_weekday b wd;
add_date b rem.date;
Buffer.add_char b ' ';
@@ -145,6 +148,7 @@ let render_single rem =
let b = Buffer.create 256 in
add_rem b;
add_info b rem.original_uuid;
add_source b rem.source;
add_date b rem.date;
add_at b rem.time;
add_duration b rem.duration;
@@ -152,11 +156,13 @@ let render_single rem =
add_msg b rem.summary;
Buffer.contents b
let render_yearly month day summary =
let render_yearly rem month day =
let b = Buffer.create 64 in
add_rem b;
add_info b rem.original_uuid;
add_source b rem.source;
Buffer.add_string b (spf "%s %d" (month_of_int month |> string_of_month) day);
add_msg b summary;
add_msg b rem.summary;
Buffer.contents b
(* ── dispatcher ───────────────────────────────────────────────── *)
@@ -169,5 +175,5 @@ let string_of_rem rem =
| Some w -> render_weekly rem w
| None -> (
match rem.yearly with
| Some (month, day) -> render_yearly month day rem.summary
| Some (month, day) -> render_yearly rem month day
| None -> render_single rem))