From 4ef5570c348e2d8d83c67e049b06e7b5d1a7542d Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Wed, 29 Jul 2026 08:24:34 +0200 Subject: feat(cli): --cal-dump NAME to generate a commented calendar template Replace the static examples/sanctorale-of.ini with a `--cal-dump NAME` flag that writes the running universal calendar to ~/.config/lectio/calendars/NAME.ini as a fully-commented layer template (every celebration present, all commented). Uncomment one day and edit a field to override it; enable with `use = NAME`. - Form-aware: respects -l/--lectionary, so `-l trad --cal-dump x` dumps the 1962 calendar (322 entries) and the default dumps the OF calendar (212 entries). - Entries sorted by date then slug; refuses to overwrite an existing file. - Always in sync with the embedded (or sanctorale-overridden) calendar, so no stale checked-in template to maintain. - Update help text, man page (OPTIONS/FILES/EXAMPLES) and README to match; drop examples/sanctorale-of.ini. --- internal/cli/cli.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/cli/cli.go') diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 078d0c2..ffefd54 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -46,6 +46,8 @@ Flags: --week list the coming week's gospel references and exit -L, --liturgy print the computed liturgical day (offline, no network) and exit --cal-new NAME scaffold a custom calendar layer ~/.config/lectio/calendars/NAME.ini + --cal-dump NAME dump the whole universal calendar to NAME.ini, commented, + to uncomment+edit one day (add -l trad for the 1962 form) --cal-check NAME validate a custom calendar layer NAME.ini and exit --corpus-check X validate a bible corpus (code, e.g. drb, or a path to a .tsv) and exit; errors fail, coverage gaps warn @@ -132,7 +134,7 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int { var list bool var ref string var liturgy bool - var calNew, calCheck string + var calNew, calCheck, calDump string var corpusCheck string var jsonOut bool var format, fromFlag, toFlag, yearFlag, formFlag string @@ -174,6 +176,7 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int { fs.BoolVar(&liturgy, "liturgy", false, "print the computed liturgical day (offline calendar engine) and exit") fs.StringVar(&calNew, "cal-new", "", "scaffold a new calendar-layer file NAME.ini and exit") fs.StringVar(&calCheck, "cal-check", "", "validate the calendar-layer file NAME.ini and exit") + fs.StringVar(&calDump, "cal-dump", "", "dump the universal calendar to NAME.ini as a commented layer template and exit") fs.StringVar(&corpusCheck, "corpus-check", "", "validate a bible corpus (code or path to .tsv) and exit") fs.BoolVar(&jsonOut, "json", false, "with --corpus-check, print the report as JSON") fs.StringVar(&format, "format", "", "json|ical: emit the computed calendar and exit") @@ -229,6 +232,10 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int { cfg.UILanguage = config.NormalizeUILanguage(uiLang) } + if calDump != "" { + return runCalDump(cfg, calDump, formFlag, stdout, stderr) + } + // `--year N` on its own prints the human-readable key-dates overview; // with --format (or --from/--to) it emits the machine calendar via runFeed. if yearFlag != "" && format == "" && fromFlag == "" && toFlag == "" { -- cgit v1.3