aboutsummaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go24
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,