diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 23:45:07 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 23:45:07 +0200 |
| commit | c1b954ad517cef00bf480d5229b253a8c6524be7 (patch) | |
| tree | 376a281de7604782722d5780657aff319c32a1d6 /internal/config/config.go | |
| parent | 369c995292b0ae830e077c5845f0b09fbe3508a4 (diff) | |
| download | lectio-c1b954ad517cef00bf480d5229b253a8c6524be7.tar.gz lectio-c1b954ad517cef00bf480d5229b253a8c6524be7.zip | |
cli-ui,web: real flag parsing for lectio-ui/lectio-web (accept useful flags, reject unknown, -h/-v)
Diffstat (limited to 'internal/config/config.go')
| -rw-r--r-- | internal/config/config.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index dd81544..7cef184 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -22,6 +22,10 @@ import ( //go:embed config.toml var seedTOML []byte +// Version is lectio's release version, shared by every binary's +// -v/--version output (lectio, lectio-ui, lectio-web). +const Version = "0.1.0" + // validVersions are the five scripture versions lectio understands. var validVersions = map[string]bool{ "pl": true, @@ -31,6 +35,26 @@ var validVersions = map[string]bool{ "drb": true, } +// ValidVersion reports whether v is one of the five scripture versions +// lectio understands (pl, wuj, vul, grb, drb). +func ValidVersion(v string) bool { + return validVersions[v] +} + +// NormalizeLectionary maps -l/--lectionary's accepted spellings ("new", +// "trad", "traditional") onto the canonical Config.Lectionary values ("new", +// "traditional"); anything else reports ok=false. +func NormalizeLectionary(s string) (string, bool) { + switch strings.ToLower(s) { + case "new": + return "new", true + case "trad", "traditional": + return "traditional", true + default: + return "", false + } +} + // validDisplays are the lectio-web reading-pane layouts. var validDisplays = map[string]bool{ "horizontal": true, |
