refactor: remove remind_sync wrapper library and inline utilities
The `remind_sync` library was acting as a thin re-export layer. This commit removes it entirely and moves the only non-trivial utility (`show_error` for `Timedesc.Date.Ymd.error`) directly into `bin/utils.ml`. Dead `[@@deriving show]` annotations on `rem`, `week_first_day`, and `error` types are also removed.
This commit is contained in:
1
bin/dune
1
bin/dune
@@ -5,7 +5,6 @@
|
||||
(preprocess
|
||||
(pps ppx_deriving.show))
|
||||
(libraries
|
||||
remind_sync
|
||||
cmdliner
|
||||
icalendar
|
||||
timedesc-tzdb.full
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
open Remind_sync
|
||||
open Icalendar
|
||||
open Utils
|
||||
|
||||
@@ -148,11 +147,9 @@ open Utils
|
||||
priorita: Quando serve
|
||||
*)
|
||||
|
||||
type error = Invalid_date of string | Skip [@@deriving show]
|
||||
|
||||
let invalid_date s e =
|
||||
Error (Invalid_date (spf "Invalid date: %s, error: %s" s (Remind_sync.Timedesc.Date.Ymd.show_error e)))
|
||||
type error = Invalid_date of string | Skip
|
||||
|
||||
let invalid_date s e = Error (Invalid_date (spf "Invalid date: %s, error: %s" s (show_error e)))
|
||||
let skip = Error Skip
|
||||
|
||||
type collector = Remind.rem -> event -> (Remind.rem, error) result
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
open Remind_sync
|
||||
module Map = MoreLabels.Map.Make (String)
|
||||
|
||||
(*
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
open Remind_sync
|
||||
open Utils
|
||||
|
||||
type week_first_day = [ `Sunday | `Monday ] [@@deriving show]
|
||||
type week_first_day = [ `Sunday | `Monday ]
|
||||
|
||||
type simple_weekly = {
|
||||
count_or_until : Icalendar.count_or_until option;
|
||||
@@ -9,7 +8,6 @@ type simple_weekly = {
|
||||
byday : Icalendar.weekday list;
|
||||
week_start : week_first_day option; (** First day of the week for weekly recurrence *)
|
||||
}
|
||||
[@@deriving show]
|
||||
(** A simple weekly REM command *)
|
||||
|
||||
type rem = {
|
||||
@@ -26,7 +24,6 @@ type rem = {
|
||||
*)
|
||||
exdate : Icalendar.date_or_datetime list; (** List of excluded dates for recurring events *)
|
||||
}
|
||||
[@@deriving show]
|
||||
(** A complete REM command *)
|
||||
|
||||
let empty =
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
open Remind_sync
|
||||
open Icalendar
|
||||
|
||||
type months = Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec
|
||||
|
||||
let show_error (e : Timedesc.Date.Ymd.error) : string =
|
||||
match e with
|
||||
| `Does_not_exist -> "Date does not exist"
|
||||
| `Invalid_year y -> Printf.sprintf "Invalid year: %d" y
|
||||
| `Invalid_month m -> Printf.sprintf "Invalid month: %d" m
|
||||
| `Invalid_day d -> Printf.sprintf "Invalid day: %d" d
|
||||
|
||||
let string_of_weekday = function
|
||||
| `Monday -> "Mon"
|
||||
| `Tuesday -> "Tue"
|
||||
|
||||
Reference in New Issue
Block a user