aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/cli.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-29 08:24:34 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-29 08:24:34 +0200
commit4ef5570c348e2d8d83c67e049b06e7b5d1a7542d (patch)
tree1da35c3bd67f4235f8ed58af6f3f6e27eaa5a270 /internal/cli/cli.go
parent802cedfa3b92a07247bf513b90e0fdff71201294 (diff)
downloadlectio-4ef5570c348e2d8d83c67e049b06e7b5d1a7542d.tar.gz
lectio-4ef5570c348e2d8d83c67e049b06e7b5d1a7542d.zip
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.
Diffstat (limited to 'internal/cli/cli.go')
-rw-r--r--internal/cli/cli.go9
1 files changed, 8 insertions, 1 deletions
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 <code>.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 <code>.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 == "" {