refactoring with internal
This commit is contained in:
39
cmd/main.go
39
cmd/main.go
@@ -1,9 +1,11 @@
|
||||
package main
|
||||
|
||||
import(
|
||||
"project.hechon.fr/internal/fetcher"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"project.hechon.fr/internal/config"
|
||||
)
|
||||
|
||||
func loadExclude(path string) (map[string]struct{}, error) {
|
||||
@@ -20,28 +22,47 @@ func loadExclude(path string) (map[string]struct{}, error) {
|
||||
|
||||
func main (){
|
||||
|
||||
properName, err:= loadExclude("properName.txt")
|
||||
book := config.Book{
|
||||
Name: "Psaumes",
|
||||
Version: "LSG",
|
||||
}
|
||||
|
||||
cfg := config.Cfg{
|
||||
ConfigPath: "internal/config/",
|
||||
YamlPath: "data",
|
||||
HtmlPath: "Public",
|
||||
BookList: map[string]int{
|
||||
"ps": 150,
|
||||
"pr": 31,
|
||||
},
|
||||
|
||||
Book: book,
|
||||
}
|
||||
|
||||
|
||||
properName, err:= loadExclude(cfg.ConfigPath + "properName.txt")
|
||||
if err != nil{
|
||||
log.Printf("can’t open the proper names file")
|
||||
os.Exit(1)
|
||||
}
|
||||
book := "Psaumes"
|
||||
searchedChapter := "2"
|
||||
version := "LSG"
|
||||
cfg.ProperName = properName
|
||||
|
||||
Chapter, err := fetchChapter(book, searchedChapter, version)
|
||||
searchedChapter := "2"
|
||||
|
||||
err = fetcher.FetchChapter(&cfg, searchedChapter)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("GET %s %s %s failed\n", book, searchedChapter, version)
|
||||
log.Printf("GET %s %s %s failed\n", book, searchedChapter, cfg.Book.Version)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Chapter = stripAlternativeVersification(Chapter)
|
||||
|
||||
for i, verse := range Chapter.verses{
|
||||
/*
|
||||
for i, verse := range cfg.Book.Chapters[0].Verses{
|
||||
log.Printf("==== Verse: %v ====", i+1)
|
||||
splitInPart(verse, properName)
|
||||
fetcher.SplitInPart(verse, properName)
|
||||
}
|
||||
*/
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user