-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared.go
607 lines (573 loc) · 12.3 KB
/
shared.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
package gouse
type ITest struct {
Name string
Input string
Want bool
WantErr bool
}
// These maybe not supported by all terminals
const (
DEFAULT_FG string = "\033[0m"
RED_FG string = "\033[31m"
GREEN_FG string = "\033[32m"
YELLOW_FG string = "\033[33m"
PURPLE_FG string = "\033[34m"
PINK_FG string = "\033[35m"
CYAN_FG string = "\033[36m"
WHITE_FG string = "\033[97m"
ORANGE_FG string = "\033[38;5;208m"
BLUE_FG string = "\033[38;5;27m"
MAGENTA_FG string = "\033[38;5;13m"
Gray string = "\033[37m"
)
// const (
// EmptyReg = `^$`
// SpaceReg = `\s+`
// WordNumReg = `^[a-zA-Z0-9]+$`
// )
const (
UsernameReg = `^[a-zA-Z0-9_]{3,20}$`
)
const (
PasswordLenReg = `^.{8,32}$`
PasswordLowerReg = `[a-z]`
PasswordUpperReg = `[A-Z]`
PasswordDigitReg = `\d`
PasswordSpecialReg = `[!@#$%^&*]`
)
const (
EmailLenReg = `^.{8,32}$`
)
const (
PhoneReg = `^\+\d{1,2}\s?\(\d{1,4}\)\s?\d{1,6}-\d{1,6}$`
)
type IFontBannerType map[string][3]string
var DOUBLE_ALPHA = IFontBannerType{
`A`: {
`╔═╗`,
`╠═╣`,
`╩ ╩`,
},
`B`: {
`╔╗ `,
`╠╩╗`,
`╚═╝`,
},
`C`: {
`╔═╗`,
`║ `,
`╚═╝`,
},
`D`: {
`╦═╗`,
`║ ║`,
`╩═╝`,
},
`E`: {
`╔═╗`,
`║╣ `,
`╚═╝`,
},
`F`: {
`╔═╗`,
`║╣ `,
`╩ `,
},
`G`: {
`╔═╗`,
`║ ╦`,
`╚═╝`,
},
`H`: {
`╦ ╦`,
`╠═╣`,
`╩ ╩`,
},
`I`: {
` ╦ `,
` ║ `,
` ╩ `,
},
`J`: {
`╦═╦`,
` ║`,
` ═╝`,
},
`K`: {
`╦ ╦`,
`╠═╔╝`,
`╝ ╚`,
},
`L`: {
`╦ `,
`║ `,
`╩═╝`,
},
`M`: {
`╔╗╔╗`,
`║║║║`,
`╝╚╝╚`,
},
`N`: {
`╔╗╔`,
`║║║`,
`╝╚╝`,
},
`O`: {
`╔═╗`,
`║ ║`,
`╚═╝`,
},
`P`: {
`╔═╗`,
`╠═╝`,
`╩ `,
},
`Q`: {
`╔═╗`,
`║ ║`,
`╚═╚═`,
},
`R`: {
`╔═╗`,
`╠╔╝`,
`╝╚╝`,
},
`S`: {
`╔═╗`,
`╚═╗`,
`╚═╝`,
},
`T`: {
`╔╦╗`,
` ║ `,
` ╩ `,
},
`U`: {
`╦ ╦`,
`║ ║`,
`╚═╝`,
},
`V`: {
`╦ ╦`,
`╚╗ ╔╝`,
` ╚╔╝`,
},
`W`: {
`╦ ╦`,
`║║║`,
`╚╩╝`,
},
`X`: {
`╚╔╝`,
`╔╝╗`,
},
`Y`: {
`╦ ╦`,
`╚╔╝`,
` ╩ `,
},
`Z`: {
`╔═╗`,
`╔═╝`,
`╚═╝`,
},
`0`: {
`╔═╗`,
`║ ║`,
`╚═╝`,
},
`1`: {
` ╦ `,
` ║ `,
` ╩ `,
},
`2`: {
`╔═╗`,
`╔═╝`,
`╚══`,
},
`3`: {
`╔═╗`,
`╚═╗`,
`╚═╝`,
},
`4`: {
`╦ ╦`,
`╚═╣`,
` ╩`,
},
`5`: {
`╔═╗`,
`╚═╗`,
`╚═╝`,
},
`6`: {
`╔═╗`,
`╠═╗`,
`╚═╝`,
},
`7`: {
`╔═╗`,
` ═║`,
` ╩`,
},
`8`: {
`╔═╗`,
`╠═╣`,
`╚═╝`,
},
`9`: {
`╔═╗`,
`╚═╣`,
`╚═╝`,
},
}
// var zero =
// `███
// █ █
// █ █
// █ █
// ███`
// var one =
// `██
// █
// █
// █
// ███`
// var two =
// `███
// █
// ███
// █
// ███`
// var three =
// `███
// █
// ███
// █
// ███`
// var four =
// `█ █
// █ █
// ███
// █
// █`
// var five =
// `███
// █
// ███
// █
// ███`
// var six =
// `███
// █
// ███
// █ █
// ███`
// var seven =
// `███
// █
// █
// █
// █`
// var eight =
// `███
// █ █
// ███
// █ █
// ███`
// var nine =
// `███
// █ █
// ███
// █
// ███`
// var colon =
// `
// ░
// ░
// `
const (
// basic symbols
SCOPE_SYM string = " ⦿ "
INPUT_SYM string = " » "
AGAIN_SYM string = " ↺ "
EXIT_SYM string = " ↵ "
INFO_SYM string = " ⚠ "
QUESTION_SYM string = " ? "
SPAN_HOR_SYM string = " ↔ "
SPAN_VER_SYM string = " ↕ "
MORE_SYM string = " ... "
OK_SYM string = " ✔ "
NO_SYM string = " ✘ "
CROSS_SYM string = " ✖ "
ITEM_SYM string = " ➤ "
COPYRIGHT_SYM string = " © "
TRADEMARK_SYM string = " ™ "
REGISTER_SYM string = " ® "
AT_SYM string = " @ "
NUMERO_SYM string = " № "
)
const (
// arrow symbols
TO_RIGHT_CON string = " → "
TO_LEFT_SYM string = " ← "
TO_UP_SYM string = " ↑ "
TO_DOWN_SYM string = " ↓ "
ARROW3_SYM string = " ⇨ "
ARROW4_SYM string = " ⇾ "
ARROW5_SYM string = " ⇛ "
ARROW6_SYM string = " ⇝ "
ARROW7_SYM string = " ⇢ "
ARROW8_SYM string = " ⇥ "
LEFT_SYM string = " ◀ "
RIGHT_SYM string = " ▶ "
UP_SYM string = " ▲ "
DOWN_SYM string = " ▼ "
)
const (
// math symbols
PLUS_SYM string = " + "
MINUS_SYM string = " - "
MULT_SYM string = " * "
DIV_SYM string = " / "
MOD_SYM string = " % "
OR_SYM string = " | "
AND_SYM string = " & "
NOT_EQUAL_SYM2 string = " != "
LESS_SYM string = " < "
GREATER_SYM string = " > "
LESS_EQUAL_SYM2 string = " <= "
GREATER_EQUAL_SYM2 string = " >= "
APPROX_EQUAL_SYM2 string = " ~= "
ASSIGN_SYM string = " = "
PLUS_ASSIGN_SYM string = " += "
MINUS_ASSIGN_SYM string = " -= "
MULT_ASSIGN_SYM string = " *= "
DIV_ASSIGN_SYM string = " /= "
SECTION_SYM string = " § "
PI_SYM string = " π "
INFINITY_SYM string = " ∞ "
NOT_EQUAL_SYM string = " ≠ "
LESS_EQUAL_SYM string = " ≤ "
GREATER_EQUAL_SYM string = " ≥ "
APPROX_EQUAL_SYM string = " ≈ "
PLUSMINUS_SYM string = " ± "
NOT_SYM string = " ¬ "
NANO_SYM string = " n "
MILLI_SYM string = " m "
KILO_SYM string = " k "
MEGA_SYM string = " M "
GIGA_SYM string = " G "
TERA_SYM string = " T "
PICO_SYM string = " p "
FEMTO_SYM string = " f "
ATTO_SYM string = " a "
ZEPTO_SYM string = " z "
YOCTO_SYM string = " y "
SQUARED_SYM string = " ² "
CUBED_SYM string = " ³ "
POWER_6_SYM string = " ⁶ "
POWER_9_SYM string = " ⁹ "
POWER_12_SYM string = " ¹² "
SQUARE_ROOT_SYM string = " √ "
CUBE_ROOT_SYM string = " ∛ "
// set symbols
EMPTY_SET_SYM string = " ∅ "
SUBSET_SYM string = " ⊂ "
SUBSET_EQUAL_SYM string = " ⊆ "
SUPERSET_SYM string = " ⊃ "
SUPERSET_EQUAL_SYM string = " ⊇ "
INTERSECTION_SYM string = " ∩ "
UNION_SYM string = " ∪ "
// logic symbols
EXISTS_SYM string = " ∃ "
FORALL_SYM string = " ∀ "
NOT_EXISTS_SYM string = " ∄ "
NOT_FORALL_SYM string = " ∁ "
IMPLIES_SYM string = " ⇒ "
IMPLIES2_SYM string = " ⟹ "
IMPLIES3_SYM string = " ⟼ "
IMPLIES4_SYM string = " ⟾ "
IMPLIES5_SYM string = " ⟺ "
IMPLIES6_SYM string = " ⟸ "
IMPLIES7_SYM string = " ⇔ "
IMPLIES8_SYM string = " ⇎ "
IMPLIES9_SYM string = " ⇏ "
IMPLIES10_SYM string = " ⇍ "
IMPLIES13_SYM string = " ⇐ "
IMPLIES15_SYM string = " ⇌ "
)
const (
// physics symbols
OHM_SYM string = " Ω "
ANGSTROM_SYM string = " Å "
DEGREE_C_SYM string = " ℃ "
DEGREE_F_SYM string = " ℉ "
DEGREE_SYM string = " ° "
DEGREE_K_SYM string = " K "
DEGREE_R_SYM string = " °R "
DEGREE_REAUMUR_SYM string = " °Ré "
DEGREE_RANKINE_SYM string = " °Ra "
DEGREE_NEWTON_SYM string = " °N "
DEGREE_DELISLE_SYM string = " °De "
DEGREE_ROMER_SYM string = " °Rø "
DEGREE_GALILEO_SYM string = " °G "
)
const (
// chemistry symbols
DEGREE_BAUME_SYM string = " °Bé "
DEGREE_TWADDELL_SYM string = " °Tw "
)
const (
// greek symbols
ALPHA_SYM string = " α "
BETA_SYM string = " β "
GAMMA_SYM string = " γ "
DELTA_SYM string = " δ "
EPSILON_SYM string = " ε "
ZETA_SYM string = " ζ "
ETA_SYM string = " η "
THETA_SYM string = " θ "
IOTA_SYM string = " ι "
KAPPA_SYM string = " κ "
LAMBDA_SYM string = " λ "
MU_SYM string = " μ "
NU_SYM string = " ν "
XI_SYM string = " ξ "
OMICRON_SYM string = " ο "
PI_SYM2 string = " π "
RHO_SYM string = " ρ "
SIGMA_SYM string = " σ "
TAU_SYM string = " τ "
UPSILON_SYM string = " υ "
PHI_SYM string = " φ "
CHI_SYM string = " χ "
PSI_SYM string = " ψ "
OMEGA_SYM string = " ω "
)
const (
// geometric symbols
DOT_SYM string = " • "
CIRCLE_SYM string = " ○ "
SQUARE_SYM string = " ■ "
TRIANGLE_SYM string = " △ "
QUADRANGLE_SYM string = " □ "
PENTAGON_SYM string = " ⬟ "
HEXAGON_SYM string = " ⬡ "
HEPTAGON_SYM string = " ⬢ "
OCTAGON_SYM string = " ⬣ "
ENNEAGON_SYM string = " ⬤ "
DECAGON_SYM string = " ⬥ "
HEXAGON2_SYM string = " ⬦ "
HEPTAGON2_SYM string = " ⬧ "
OCTAGON2_SYM string = " ⬨ "
ENNEAGON2_SYM string = " ⬩ "
DECAGON2_SYM string = " ⬪ "
HEXAGON3_SYM string = " ⬫ "
HEPTAGON3_SYM string = " ⬬ "
OCTAGON3_SYM string = " ⬭ "
ENNEAGON3_SYM string = " ⬮ "
DECAGON3_SYM string = " ⬯ "
HEXAGON4_SYM string = " ⬰ "
HEPTAGON4_SYM string = " ⬱ "
OCTAGON4_SYM string = " ⬲ "
ENNEAGON4_SYM string = " ⬳ "
DECAGON4_SYM string = " ⬴ "
)
const (
// currency symbols
POUND_SYM string = " £ "
YEN_SYM string = " ¥ "
EURO_SYM string = " € "
CENT_SYM string = " ¢ "
DOLLAR_SYM string = " $ "
CURRENCY_SYM string = " ¤ "
PERMILLE_SYM string = " ‰ "
PERMYRIAD_SYM string = " ‱ "
VIETNAM_SYM string = " ₫ "
ROUBLE_SYM string = " ₽ "
BAHT_SYM string = " ฿ "
INDIAN_SYM string = " ₹ "
RIAL_SYM string = " ﷼ "
LIRA_SYM string = " ₤ "
DRACHMA_SYM string = " ₯ "
NAIRA_SYM string = " ₦ "
PESETA_SYM string = " ₧ "
RUPEE_SYM string = " ₨ "
FRANC_SYM string = " ₣ "
LEU_SYM string = " ₗ "
AFGHANI_SYM string = " ؋ "
)
const (
// card symbols
CLUB_SYM string = " ♣ "
DIAMOND_SYM string = " ♦ "
HEART_SYM string = " ♥ "
SPADE_SYM string = " ♠ "
)
const (
// chess symbols
WHITE_KING_SYM string = " ♔ "
WHITE_QUEEN_SYM string = " ♕ "
WHITE_ROOK_SYM string = " ♖ "
WHITE_BISHOP_SYM string = " ♗ "
WHITE_KNIGHT_SYM string = " ♘ "
WHITE_PAWN_SYM string = " ♙ "
BLACK_KING_SYM string = " ♚ "
BLACK_QUEEN_SYM string = " ♛ "
BLACK_ROOK_SYM string = " ♜ "
BLACK_BISHOP_SYM string = " ♝ "
BLACK_KNIGHT_SYM string = " ♞ "
BLACK_PAWN_SYM string = " ♟ "
)
const (
// weather symbols
SUNNY_SYM string = " ☀ "
CLOUDY_SYM string = " ☁ "
RAIN_SYM string = " ☂ "
SNOW_SYM string = " ☃ "
THUNDERSTORM_SYM string = " ☇ "
SUNNY_CLOUDY_SYM string = " ☼ "
RAIN_CLOUDY_SYM string = " ☂☁ "
SNOW_CLOUDY_SYM string = " ☃☁ "
THUNDERSTORM_CLOUDY string = " ☇☁ "
SUNNY_RAIN_SYM string = " ☀☂ "
SUNNY_SNOW_SYM string = " ☀☃ "
SUNNY_THUNDERSTORM_SYM string = " ☀☇ "
CLOUDY_RAIN_SYM string = " ☁☂ "
CLOUDY_SNOW_SYM string = " ☁☃ "
CLOUDY_THUNDERSTORM string = " ☁☇ "
RAIN_SNOW_SYM string = " ☂☃ "
RAIN_THUNDERSTORM_SYM string = " ☂☇ "
SNOW_THUNDERSTORM_SYM string = " ☃☇ "
)
const (
// astrological symbols
SUN_SYM string = " ☉ "
MOON_SYM string = " ☽ "
MERCURY_SYM string = " ☿ "
VENUS_SYM string = " ♀ "
EARTH_SYM string = " ⊕ "
MARS_SYM string = " ♂ "
JUPITER_SYM string = " ♃ "
SATURN_SYM string = " ♄ "
URANUS_SYM string = " ♅ "
NEPTUNE_SYM string = " ♆ "
PLUTO_SYM string = " ♇ "
CONJUNCTION_SYM string = " ☌ "
OPPOSITION_SYM string = " ☍ "
SEXTILE_SYM string = " ⚹ "
TRINE_SYM string = " ⚸ "
ASC_NODE_SYM string = " ☊ "
DESC_NODE_SYM string = " ☋ "
BLACK_MOON_SYM string = " ☾ "
)
const (
// religious symbols
CHRISTIAN_SYM string = " ✝ "
JEWISH_SYM string = " ✡ "
ISLAMIC_SYM string = " ☪ "
YIN_YANG_SYM string = " ☯ "
)