-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (32 loc) · 1.17 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
package main
import (
"flag"
"log"
)
func main() {
var questionFontSize float64
var answerFontSize float64
var questionAnswerDelineator string
var cardDelineator string
var inputFilePath string
var outputFilePath string
flag.Float64Var(&questionFontSize, "qfs", 25, "Sets the font size for the question side of the flashcard.")
flag.Float64Var(&answerFontSize, "afs", 20, "Sets the font size for the answer side of the flashcard.")
flag.StringVar(&questionAnswerDelineator, "qd", "##", "Sets the delineator in between a question and answer. (Can cause errors)")
flag.StringVar(&cardDelineator, "cd", "####", "Sets the delineator in between each card. (Can cause errors)")
flag.StringVar(&inputFilePath, "i", "./cards.txt", "Sets the input filepath.")
flag.StringVar(&outputFilePath, "o", "./docs/flashcards.pdf", "Sets the output filepath. Make sure to include the \".pdf\" extension")
flag.Parse()
cards := getCardsList(inputFilePath)
m := getMaroto(cards, questionFontSize, answerFontSize)
//Generate document
doc, err := m.Generate()
if err != nil {
log.Fatal(err.Error())
}
//Save document
err = doc.Save(outputFilePath)
if err != nil {
log.Fatal(err.Error())
}
}