summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/lectio-ui/main.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd/lectio-ui/main.go b/cmd/lectio-ui/main.go
index 023cf66..d8e2f27 100644
--- a/cmd/lectio-ui/main.go
+++ b/cmd/lectio-ui/main.go
@@ -10,6 +10,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
+ "github.com/lukaszkasprzak/lectio/internal/bible"
"github.com/lukaszkasprzak/lectio/internal/config"
"github.com/lukaszkasprzak/lectio/internal/tui"
)
@@ -21,6 +22,7 @@ Usage:
Flags:
-b, --bible VER start on version: bt,wuj,vul,grb,drb
+ -R, --reader open the Bible reader (book picker) instead of the daily view
-a, --all show all parts (override config)
-o, --offline cache/sigla only, no network
-l, --lectionary WHICH new|trad (trad -> traditional)
@@ -64,7 +66,7 @@ func run(args []string, stdout, stderr io.Writer) int {
return 1
}
- var all, offline bool
+ var all, offline, reader bool
var bibleVer, lectionary, lang string
fs := flag.NewFlagSet("lectio-ui", flag.ContinueOnError)
@@ -73,6 +75,8 @@ func run(args []string, stdout, stderr io.Writer) int {
fs.StringVar(&bibleVer, "b", "", "start on version: bt,wuj,vul,grb,drb")
fs.StringVar(&bibleVer, "bible", "", "start on version: bt,wuj,vul,grb,drb")
+ fs.BoolVar(&reader, "R", false, "open the Bible reader (fuzzy book picker) instead of the daily view")
+ fs.BoolVar(&reader, "reader", false, "open the Bible reader (fuzzy book picker) instead of the daily view")
fs.BoolVar(&all, "a", cfg.All, "show all parts (override config)")
fs.BoolVar(&all, "all", cfg.All, "show all parts (override config)")
fs.BoolVar(&offline, "o", cfg.Offline, "cache/sigla only, no network")
@@ -113,7 +117,12 @@ func run(args []string, stdout, stderr io.Writer) int {
cfg.TraditionalLang = lang
}
- if _, err := tea.NewProgram(tui.New(cfg, date, bibleVer), tea.WithAltScreen()).Run(); err != nil {
+ var mdl tea.Model = tui.New(cfg, date, bibleVer)
+ if reader {
+ tbl, _ := bible.LoadBookTable(config.UserBooksTOML())
+ mdl = tui.NewReader(cfg, tbl)
+ }
+ if _, err := tea.NewProgram(mdl, tea.WithAltScreen()).Run(); err != nil {
fmt.Fprintln(stderr, err)
return 1
}