feat: add source file tracking to rem type

Add a `source` field to `Remind.rem` to track the originating iCalendar
filename (basename without extension). Thread the basename through
`remind_of_event` so each reminder records which file it came from.
This commit is contained in:
2026-05-16 22:14:27 +02:00
parent 9445eb81e8
commit 4e6ba30f2d
3 changed files with 6 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ let ical2rem ical_files =
try
Printf.eprintf "\nProcessing file: %s\n" filename;
let file_content = read_file filename in
let basename = Filename.remove_extension (Filename.basename filename) in
match Icalendar.parse file_content with
| Error e ->
if e <> ": not enough input" then prerr_endline ("Error parsing iCalendar file: " ^ e);
@@ -39,7 +40,7 @@ let ical2rem ical_files =
let good_rems =
Map.fold ~init:[] events_map ~f:(fun ~key:uid ~data:events good_rems ->
let rem_or_error = EventPredicates.remind_of_event events in
let rem_or_error = EventPredicates.remind_of_event basename events in
match rem_or_error with
| Ok rem -> rem :: good_rems
| Error (EventPredicates.Invalid_date s) ->