feat: initial implementation of iCalendar to Remind converter
- Add project scaffolding (dune, dune-project, opam, .ocamlformat) - Implement basic parsing and handling of iCalendar events - Add event predicates for common event types (all-day, timed, recurrence, exceptions) - Add transformation logic to map iCalendar events to Remind format (stub implementation) - Provide utilities for extracting event details and converting dates/times - Set up executable entrypoint and command-line interface using Cmdliner - Include Remind event type definitions and helpers
This commit is contained in:
15
bin/eventTransformer.ml
Normal file
15
bin/eventTransformer.ml
Normal file
@@ -0,0 +1,15 @@
|
||||
let default_implementation = Remind.Omit (Ptime.epoch |> Ptime.to_date)
|
||||
|
||||
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)
|
||||
|> 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 "\n"
|
||||
end;
|
||||
default_implementation
|
||||
Reference in New Issue
Block a user