diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 13:34:39 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 13:34:39 +0200 |
| commit | 3a43b6199a518dd85c2607c6af47b1e3b5d4ae76 (patch) | |
| tree | fcac89e46dc30d08aa96e77cc75529aebbfcdb21 /internal | |
| parent | 6aaedcec712d254d3bc48afac37e44bc7a84e940 (diff) | |
| download | lectio-3a43b6199a518dd85c2607c6af47b1e3b5d4ae76.tar.gz lectio-3a43b6199a518dd85c2607c6af47b1e3b5d4ae76.zip | |
fix(cli): --liturgy signals EF-not-implemented instead of silently returning OF
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/cli/liturgy.go | 8 | ||||
| -rw-r--r-- | internal/cli/liturgy_test.go | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/internal/cli/liturgy.go b/internal/cli/liturgy.go index fabac48..24052ab 100644 --- a/internal/cli/liturgy.go +++ b/internal/cli/liturgy.go @@ -23,6 +23,14 @@ func runLiturgy(cfg config.Config, date string, stdout, stderr io.Writer) int { fmt.Fprintf(stderr, "lectio: bad date %q (want YYYY-MM-DD)\n", date) return 2 } + // The computed engine currently does the Ordinary Form only. Rather than + // silently return OF for a traditional (EF) config, say so. + if cfg.Selection().Form == "old" { + fmt.Fprintln(stderr, "lectio: the offline calendar engine currently computes only the Ordinary Form.") + fmt.Fprintln(stderr, " Traditional (1962 EF) computation is not built yet; your traditional daily") + fmt.Fprintln(stderr, " readings still work via 'lectio [DATE]'. To compute the OF: add --lectionary new.") + return 1 + } dir, _ := config.CalendarsDir() layers, errs := caldata.Stack(dir, cfg.Use) for _, e := range errs { diff --git a/internal/cli/liturgy_test.go b/internal/cli/liturgy_test.go index c713703..02f02c4 100644 --- a/internal/cli/liturgy_test.go +++ b/internal/cli/liturgy_test.go @@ -33,6 +33,23 @@ func TestRunLiturgy(t *testing.T) { } } +func TestRunLiturgyTraditionalGuarded(t *testing.T) { + dir := t.TempDir() + t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) + os.WriteFile(filepath.Join(dir, "config.ini"), []byte("lectionary = traditional\n"), 0o644) + cfg, err := config.Load() + if err != nil { + t.Fatal(err) + } + var buf bytes.Buffer + if code := runLiturgy(cfg, "2025-08-15", &buf, &buf); code == 0 { + t.Fatalf("traditional config should be guarded, not computed as OF:\n%s", buf.String()) + } + if !strings.Contains(strings.ToLower(buf.String()), "ordinary form") { + t.Errorf("expected an EF-not-implemented notice:\n%s", buf.String()) + } +} + func TestRunLiturgyUserLayer(t *testing.T) { dir := t.TempDir() t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) |
