forked from GreenRaccoon23/bgmysword
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_windows.go
224 lines (199 loc) · 4.86 KB
/
display_windows.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
package main
import (
"bufio"
"fmt"
"os"
"strings"
//"github.com/PuerkitoBio/goquery"
//"github.com/fatih/color"
//"github.com/mattn/go-sqlite3"
)
func ColorUnset() {
}
func ImgSword() {
image := []string{
" , ",
" // ",
"0==={0}>>>>>>>>>>>>>",
" \\\\ ",
" ` ",
}
PrintSlice(image)
}
func ImgINRI() {
image := []string{
" .======. ",
" | INRI | ",
" | | ",
" | | ",
" .========' '========. ",
" | _ xxxx _ | ",
" | /_;-.__ / _\\ _.-;_\\ | ",
" | `-._`'`_/'`.-' | ",
" '========.`\\ /`========' ",
" | | / | ",
" |/-.( | ",
" |\\_._\\ | ",
" | \\ \\`;| ",
" | > |/| ",
" | / // | ",
" | |// | ",
" | \\(\\ | ",
" | `` | ",
" | | ",
" | | ",
" | | ",
" | | ",
" \\\\jgs _ _\\\\| \\// |//_ _ \\// _ ",
" ^ `^`^ ^`` `^ ^` ``^^` `^^` `^ `^ ",
}
PrintSlice(image)
}
func Exit() {
os.Exit(0)
}
func printHelp() {
defer Exit()
fmt.Printf(
"How to use:\n bgmysword <translation>\nExample:\n bgmysword KJV\n",
)
}
func PrintSlice(sl []string) {
for _, st := range sl {
PrintCenterLines(st)
}
}
func PrintCenterLines(st string) {
sl := strings.Split(st, "\n")
for _, s := range sl {
PrintCenter(s)
}
}
func PrintCenterUnknownLines(st string) {
switch {
case len(st) > 78:
sl := strings.SplitAfter(st, " ")
half := len(sl) / 2
stBeg := strings.TrimSpace(str(sl[:half]))
stEnd := strings.TrimSpace(str(sl[half:]))
PrintCenterUnknownLines(stBeg)
PrintCenterUnknownLines(stEnd)
default:
PrintCenter(st)
}
}
func PrintCenter(t string) {
w := 39 - len(t)/2
s := strings.Repeat(" ", w)
fmt.Printf("%v%v%v\n", s, t, s)
}
func printRemovedFile(fileName string) {
fmt.Println("Removed", fileName)
}
func Break(s string) {
fmt.Println(strings.Repeat(s, 79))
}
func Line() {
Break("-")
}
func BLine() {
Break("=")
}
func progressTranslation() {
BLine()
fmt.Println(transName)
}
func progressBook(index int) {
var spacingNumber string = ""
book := Bible[index].Book
bookTitle := strings.Replace(book, "+", " ", -1)
numberOfSpaces := 30 - len(bookTitle)
spacingTitle := strings.Repeat(" ", numberOfSpaces)
bookNumber := index + 1
if bookNumber < 10 {
spacingNumber = " "
}
fmt.Printf("\r=>%v%v%v%d/%d\n",
bookTitle, spacingTitle, spacingNumber, bookNumber, 66)
}
func progressChapter(current, total int) {
fmt.Printf("\r ->%d/%d", current, total)
}
func Input() (answer string) {
reader := bufio.NewReader(os.Stdin)
response, _ := reader.ReadString('\n')
answer = strings.TrimSpace(response)
return
}
func inputTranslation() (answer string) {
fmt.Println(
"Enter the abbreviation of the translation to download",
)
fmt.Println(
" using the same abbreviation that biblegateway.com uses.",
)
fmt.Println(
"(They're listed at 'biblegateway.com/versions')",
)
fmt.Printf(
"\n==> ",
)
answer = Input()
return
}
func copyrightAccept(copyrightInfo, publisherInfo string) {
Line()
PrintCenter(
"License Agreement")
Line()
PrintCenter(fmt.Sprintf(
`This program will generate a MySword bible module for the %v Bible`,
translation,
))
PrintCenter(fmt.Sprintf(
`by looking up the %v Bible on https://www.biblegateway.org/`,
translation,
))
fmt.Printf("\n")
PrintCenter(fmt.Sprintf(
`BibleGateway License for %v`,
translation,
))
PrintCenter(transName)
PrintCenterUnknownLines(copyrightInfo)
fmt.Printf("\n")
PrintCenter(
"Agreement",
)
PrintCenterLines(fmt.Sprintf(
` By using this program, I declare that my local copyright law does not forbid
the use of this website for a purpose other than webbrowsing. I will not
distribute any module generated by this program unless explicitely permitted by
%v
I accept full responsibility for all copyright violations that
are the result of using this program and absolve the author of any
responsibility for them.
I understand that I may distribute and/or modify this program itself,
but not any modules generated by it.`,
publisherInfo,
))
PrintCenter(
"In other words, don't abuse this program.",
)
PrintCenter(
`If you wish to accept the statements above enter the exact word "accept."`,
)
PrintCenter(
"Then press [ENTER]. ",
)
fmt.Printf(
"==> ",
)
ansAgree := Input()
accepted := strings.EqualFold(ansAgree, "accept")
switch accepted {
case false:
fmt.Println("License not accepted.")
os.Exit(0)
}
}