summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/config/config.go44
-rw-r--r--internal/config/config.ini26
2 files changed, 36 insertions, 34 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 78e364c..913962b 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -9,7 +9,6 @@
package config
import (
- _ "embed"
"fmt"
"os"
"path/filepath"
@@ -23,11 +22,39 @@ import (
"github.com/lukaszkasprzak/lectio/internal/ini"
)
-// seedINI is the embedded default config.ini, written to disk on first run and
-// parsed as the fallback default values.
-//
-//go:embed config.ini
-var seedINI []byte
+// configHeader is the reference comment block written at the top of every
+// generated config.ini (the first-run seed and every Save), documenting each
+// option's allowed values. Full-line comments only, so the INI reader skips
+// them and values stay verbatim.
+const configHeader = `# lectio configuration (INI). Full-line comments only (# or ;); no inline comments.
+# Lists are comma-separated. Booleans are true/false.
+#
+# Allowed values:
+# lectionary new | traditional (new = modern OF; traditional = 1962 EF)
+# traditional_lang pl | en (vernacular for traditional propers)
+# versions any of: bt, wuj, vul, grb, drb (comma list; bt = Biblia Tysiąclecia)
+# default_version bt | wuj | vul | grb | drb
+# width integer; 0 = detect terminal width
+# all true | false (all readings, or just the gospel)
+# offline true | false (never fetch; cache/sigla only)
+# ui_language en | pl (interface chrome; readings stay source-language)
+# sigla_style auto | polish | english (citation dialect; auto follows ui_language)
+# web_theme a theme name (see docs/THEMES.md)
+# web_port integer; 0 = try 1099, then any free port
+# web_display horizontal | vertical | interlinear
+# web_mono true | false (monospace reading face in the web UI)
+# web_versions any of: bt, wuj, vul, grb, drb (comma list); empty = just default_version
+# pager shell command, e.g. less -R; empty = off
+#
+# [calendar] — computed-calendar placement options (defaults = Universal Roman Calendar):
+# epiphany fixed | sunday (fixed = Jan 6; sunday = the Sunday of Jan 2-8)
+# ascension thursday | sunday (sunday = moved to the following Sunday, 7th of Easter)
+# corpus_christi thursday | sunday (sunday = moved to the following Sunday)
+#
+# Optional [parts.new] / [parts.traditional] sections hide reading parts, e.g.:
+# [parts.new]
+# psalm = false
+`
// Version is lectio's release version, shared by every binary's
// -v/--version output (lectio, lectio-ui, lectio-web).
@@ -264,7 +291,7 @@ func seedIfMissing(path string) error {
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
return err
}
- return os.WriteFile(path, seedINI, 0o644)
+ return os.WriteFile(path, renderConfigINI(Default()), 0o644)
}
// migrateFromTOML converts a former config.toml sitting next to iniPath into
@@ -466,7 +493,8 @@ func Save(cfg Config) error {
// lines so no value ever shares a line with a "#"/";" comment character.
func renderConfigINI(cfg Config) []byte {
var b strings.Builder
- b.WriteString("# lectio configuration (INI). Lists are comma-separated; booleans true/false.\n\n")
+ b.WriteString(configHeader)
+ b.WriteString("\n")
fmt.Fprintf(&b, "schema_version = %d\n", cfg.SchemaVersion)
fmt.Fprintf(&b, "lectionary = %s\n", cfg.Lectionary)
fmt.Fprintf(&b, "traditional_lang = %s\n", cfg.TraditionalLang)
diff --git a/internal/config/config.ini b/internal/config/config.ini
deleted file mode 100644
index 1e5ed94..0000000
--- a/internal/config/config.ini
+++ /dev/null
@@ -1,26 +0,0 @@
-# lectio configuration (INI).
-# Interface/behavior settings; the computed liturgical calendar reads the
-# [calendar] section. Lists are comma-separated. Booleans are true/false.
-
-schema_version = 1
-lectionary = new
-traditional_lang = pl
-versions = bt, wuj, vul, grb, drb
-default_version = bt
-width = 0
-all = false
-offline = false
-ui_language = en
-sigla_style = auto
-web_theme = transfiguration
-web_port = 0
-web_display = horizontal
-web_mono = false
-web_versions =
-pager =
-
-# Computed-calendar national placement options (defaults = Universal Roman).
-[calendar]
-epiphany = fixed
-ascension = thursday
-corpus_christi = thursday