aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-11 15:27:53 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-11 15:27:53 +0200
commit1203380c4644277a2949d42f4619360c1c0ef1e5 (patch)
tree830fd059db243144e9819a134864e8805acc3d39
parent39c8684646f7bad7161b9eeae166b121cc580a3c (diff)
downloadcolitur-1203380c4644277a2949d42f4619360c1c0ef1e5.tar.gz
colitur-1203380c4644277a2949d42f4619360c1c0ef1e5.zip
cli: colitur temporal <year> 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.
-rw-r--r--bin/dune2
-rw-r--r--bin/main.ml42
-rw-r--r--test/cli.t24
3 files changed, 58 insertions, 10 deletions
diff --git a/bin/dune b/bin/dune
index 02a84dc..c79bbf1 100644
--- a/bin/dune
+++ b/bin/dune
@@ -2,4 +2,4 @@
(name main)
(public_name colitur)
(package colitur)
- (libraries colitur_kernel))
+ (libraries colitur_kernel rite_ef))
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 <year>";
+ prerr_endline "colitur: usage: colitur easter <year> | colitur temporal <year>";
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 ()
diff --git a/test/cli.t b/test/cli.t
index 319fc8c..276b1a1 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -17,5 +17,27 @@ A year outside the supported domain is rejected (exit 2):
No/garbage arguments give a usage error (exit 2):
$ colitur
- colitur: usage: colitur easter <year>
+ colitur: usage: colitur easter <year> | colitur temporal <year>
+ [2]
+
+The EF temporal cycle for a year, one line per day:
+
+ $ colitur temporal 2026 | head -3
+ 2026-01-01 thursday christmastide ef-circumcision class-1 white
+ 2026-01-02 friday christmastide ef-christmas-0-friday class-4 white
+ 2026-01-03 saturday christmastide ef-christmas-0-saturday class-4 white
+
+ $ colitur temporal 2026 | wc -l
+ 365
+
+ $ colitur temporal 2026 | grep -c '^2026-04-05 '
+ 1
+
+ $ colitur temporal 2026 | grep '^2026-04-05 '
+ 2026-04-05 sunday paschaltide 1 ef-easter-sunday class-1 white
+
+A year outside the supported domain is rejected (exit 2):
+
+ $ colitur temporal 1000
+ colitur: year 1000 out of range 1583..9999
[2]