-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (33 loc) · 1.03 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"os"
"github.com/AYehia0/quran-go/pkg/bubbletea"
"github.com/AYehia0/quran-go/pkg/quran"
tea "github.com/charmbracelet/bubbletea"
)
var (
bookmarkPath = "bookmark.json" // the path to the bookmark file
quranData = "quran.json" // the path to the json file containing all the ayaht
)
func main() {
// check the bookmark if it doesn't exist create a default one
// if it exists do nothing
quran.MakeBookmark(bookmarkPath)
bookmark, err := quran.ReadBookmark(bookmarkPath)
if err != nil {
fmt.Printf("Something went wrong working with the bookmark : %v\n", err)
}
// read the surahs
quranSurahs := quran.ParseQuranData(quranData)
ayahtMap := quran.AyahtInPages(quranSurahs)
p := tea.NewProgram(
bubbletea.InitModel(&ayahtMap, bookmark),
tea.WithAltScreen(), // use the full size of the terminal in its "alternate screen buffer"
tea.WithMouseCellMotion(), // turn on mouse support so we can track the mouse wheel
)
if _, err := p.Run(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}