From 1203380c4644277a2949d42f4619360c1c0ef1e5 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 11 Aug 2026 15:27:53 +0200 Subject: cli: colitur temporal dumps the EF temporal cycle One line per day -- date, weekday, season, week, slug, rank, colour -- built through Record, the canonical output view. Until Plan 3 brings the differential and oracle layers, this dump is how a human checks EF temporal against missalemeum by eye. --- bin/main.ml | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'bin/main.ml') diff --git a/bin/main.ml b/bin/main.ml index eb70a26..827e6f2 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -12,17 +12,43 @@ let easter_report y = ("corpus-christi", C.corpus_christi y) ] |> List.iter (fun (name, d) -> Printf.printf "%s %s\n" name (fmt d)) +let temporal_report y = + let jan1 = match D.make ~year:y ~month:1 ~day:1 with + | Ok t -> t + | Error e -> failwith e + in + let dec31 = match D.make ~year:y ~month:12 ~day:31 with + | Ok t -> t + | Error e -> failwith e + in + let d = ref jan1 in + while D.compare !d dec31 <= 0 do + let t = Rite_ef.Temporal_ef.temporal !d in + let r = + Colitur_kernel.Record.of_temporal ~rite:Rite_ef.Temporal_ef.id + Rite_ef.Vocab_ef.vocab !d t + in + Printf.printf "%s %s %s %s %s %s %s\n" r.Colitur_kernel.Record.date + r.Colitur_kernel.Record.weekday r.Colitur_kernel.Record.season + r.Colitur_kernel.Record.week r.Colitur_kernel.Record.slug + r.Colitur_kernel.Record.rank r.Colitur_kernel.Record.colour; + d := D.add_days !d 1 + done + let usage () = - prerr_endline "colitur: usage: colitur easter "; + prerr_endline "colitur: usage: colitur easter | colitur temporal "; exit 2 +let with_year ys f = + match int_of_string_opt ys with + | Some y when y >= 1583 && y <= 9999 -> f y + | Some y -> + Printf.eprintf "colitur: year %d out of range 1583..9999\n" y; + exit 2 + | None -> usage () + let () = match Sys.argv with - | [| _; "easter"; ys |] -> ( - match int_of_string_opt ys with - | Some y when y >= 1583 && y <= 9999 -> easter_report y - | Some y -> - Printf.eprintf "colitur: year %d out of range 1583..9999\n" y; - exit 2 - | None -> usage ()) + | [| _; "easter"; ys |] -> with_year ys easter_report + | [| _; "temporal"; ys |] -> with_year ys temporal_report | _ -> usage () -- cgit v1.3