aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/cli.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cli/cli.go')
-rw-r--r--internal/cli/cli.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
index 51a5a4b..575fba9 100644
--- a/internal/cli/cli.go
+++ b/internal/cli/cli.go
@@ -49,6 +49,8 @@ Flags:
--citation print the day's gospel reference (scripts/cron) and exit
--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-check NAME validate a custom calendar layer NAME.ini and exit
--rand, --rand-v print a random verse and exit (uses default_version or -b VER;
bt has no corpus, so it falls back to a corpus version)
--rand-ch print a random chapter and exit
@@ -121,6 +123,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
fs := flag.NewFlagSet("lectio", flag.ContinueOnError)
fs.SetOutput(stderr)
@@ -167,6 +170,8 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {
fs.StringVar(&calendar, "calendar", "", "export a month (YYYY-MM) as a printable A4 PDF calendar")
fs.BoolVar(&liturgy, "L", false, "print the computed liturgical day (offline calendar engine) and exit")
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")
if err := fs.Parse(rest); err != nil {
return 2
@@ -192,6 +197,12 @@ func Run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {
if update {
return runHarvest(date, stdout, stderr)
}
+ if calNew != "" {
+ return runCalNew(calNew, stdout, stderr)
+ }
+ if calCheck != "" {
+ return runCalCheck(calCheck, stdout, stderr)
+ }
cfg, err := config.Load()
if err != nil {