diff options
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 8ee15e1..9a41adc 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -24,7 +24,7 @@ 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.7.0" +const Version = "0.8.0" // validVersions are the five scripture versions lectio understands. var validVersions = map[string]bool{ @@ -203,6 +203,21 @@ func BooksPath() (string, error) { return filepath.Join(filepath.Dir(p), "books.toml"), nil } +// UserBooksTOML returns the bytes of the optional user books.toml (see +// BooksPath), or nil when it is absent or unreadable -- callers then fall back +// to bible's embedded default table. +func UserBooksTOML() []byte { + p, err := BooksPath() + if err != nil { + return nil + } + b, err := os.ReadFile(p) + if err != nil { + return nil + } + return b +} + // seedIfMissing writes the embedded default config to path if nothing is // there yet. func seedIfMissing(path string) error { |
