refactor(predicates): return features instead of bool, add P00/P11 predicates

- Change predicate return type from `bool` to `features list option` to
  carry extracted event data (Summary, Day_start, Multi_day) alongside
  match results
- Add `features` type with Generic_feature_presence, Summary, Day_start,
  Multi_day variants
- Add P00 (has_summary) and P11 (override_events) predicates
- Remove large commented-out icalendar/ptime type definitions
- Refactor main.ml to group events by UID using a Map
- Add get_y_m_d_from_timedesc helper to Utils
This commit is contained in:
2026-05-10 01:49:05 +02:00
parent c4fc4006c5
commit fce66c5c78
5 changed files with 174 additions and 2081 deletions

View File

@@ -3,13 +3,19 @@ let default_implementation = Remind.make_default_event "TODO: implement conversi
let remind_of_event (ev : Icalendar.event) : Remind.event =
let found =
ListLabels.fold_left ~init:[] EventPredicates.all_predicates ~f:(fun acc (pred, desc) ->
if pred ev then desc :: acc else acc)
match pred ev with
| Some feats -> (desc, feats) :: acc
| None -> acc)
|> List.rev
in
if List.length found > 0
then begin
Printf.printf " 󰧓 ⇒ matches these predicates:\n";
List.iter (fun d -> Printf.printf " - %s\n" (EventPredicates.show_event_description d)) found;
Printf.printf " \u{f04d3} \u{21d2} matches these predicates:\n";
ListLabels.iter
~f:(fun (desc, features) ->
Printf.printf " - %s\n" (EventPredicates.show_event_description desc);
ListLabels.iter ~f:(fun feat -> Printf.printf " - %s\n" (EventPredicates.show_features feat)) features)
found;
Printf.printf "\n"
end;
default_implementation