Repository navigation
Expand file tree
/
Copy pathmain.ring
More file actions
100 lines (81 loc) · 4.38 KB
/
Copy pathmain.ring
File metadata and controls
100 lines (81 loc) · 4.38 KB
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
// The Main File
load "package.ring"
load "lib.ring"
load "src/utils/color.ring"
func main() {
nInnerWidth = 51
cHLine = copy("─", nInnerWidth)
banner = []
// Top border
banner + colorText([:text = "╭" + cHLine + "╮", :color = :BRIGHT_YELLOW, :style = :BOLD])
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Title with volt symbol
cName = upper(aPackageInfo[:name])
cTitleText = "⚡ " + cName + " ⚡"
nTitleVisualWidth = len(cTitleText) - 2
nTitlePad = floor((nInnerWidth - nTitleVisualWidth) / 2)
nTitlePadRight = nInnerWidth - nTitleVisualWidth - nTitlePad
cTitleLine = colorText([:text = "│" + space(nTitlePad), :color = :BRIGHT_YELLOW]) +
colorText([:text = cTitleText, :color = :BRIGHT_YELLOW, :style = :BOLD]) +
colorText([:text = space(nTitlePadRight) + "│", :color = :BRIGHT_YELLOW])
banner + cTitleLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Version
cVersionStr = "v" + aPackageInfo[:version]
nVersionPad = floor((nInnerWidth - len(cVersionStr)) / 2)
nVersionPadRight = nInnerWidth - len(cVersionStr) - nVersionPad
cVersionLine = colorText([:text = "│" + space(nVersionPad), :color = :BRIGHT_YELLOW]) +
colorText([:text = cVersionStr, :color = :WHITE, :style = :DIM]) +
colorText([:text = space(nVersionPadRight) + "│", :color = :BRIGHT_YELLOW])
banner + cVersionLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Separator
nDotsCount = nInnerWidth - 12
cSepLine = colorText([:text = "│" + space(6), :color = :BRIGHT_YELLOW]) +
colorText([:text = copy("·", nDotsCount), :color = :WHITE, :style = :DIM]) +
colorText([:text = space(6) + "│", :color = :BRIGHT_YELLOW])
banner + cSepLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Description
cDesc = "Blazing-fast web framework for Ring"
nDescPad = floor((nInnerWidth - len(cDesc)) / 2)
nDescPadRight = nInnerWidth - len(cDesc) - nDescPad
cDescLine = colorText([:text = "│" + space(nDescPad), :color = :BRIGHT_YELLOW]) +
colorText([:text = cDesc, :color = :WHITE, :style = :DIM]) +
colorText([:text = space(nDescPadRight) + "│", :color = :BRIGHT_YELLOW])
banner + cDescLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Separator
banner + cSepLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Author
cAuthorText = "Made with by " + aPackageInfo[:developer]
nAuthorVisualWidth = len(cAuthorText) + 1
nAuthorPad = floor((nInnerWidth - nAuthorVisualWidth) / 2)
nAuthorPadRight = nInnerWidth - nAuthorVisualWidth - nAuthorPad
cAuthorLine = colorText([:text = "│" + space(nAuthorPad), :color = :BRIGHT_YELLOW]) +
colorText([:text = "Made with ", :color = :WHITE, :style = :DIM]) +
colorText([:text = cSymbols[:HEART], :color = :BRIGHT_RED]) +
colorText([:text = " by ", :color = :WHITE, :style = :DIM]) +
colorText([:text = aPackageInfo[:developer], :color = :BRIGHT_CYAN]) +
colorText([:text = space(nAuthorPadRight) + "│", :color = :BRIGHT_YELLOW])
banner + cAuthorLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// GitHub URL
cUrlStr = aPackageInfo[:providerwebsite] + "/" + aPackageInfo[:providerusername] + "/" + aPackageInfo[:folder]
nUrlPad = floor((nInnerWidth - len(cUrlStr)) / 2)
nUrlPadRight = nInnerWidth - len(cUrlStr) - nUrlPad
cUrlLine = colorText([:text = "│" + space(nUrlPad), :color = :BRIGHT_YELLOW]) +
colorText([:text = cUrlStr, :color = :GREEN, :style = :UNDERLINE]) +
colorText([:text = space(nUrlPadRight) + "│", :color = :BRIGHT_YELLOW])
banner + cUrlLine
banner + colorText([:text = "│" + space(nInnerWidth) + "│", :color = :BRIGHT_YELLOW])
// Bottom border
banner + colorText([:text = "╰" + cHLine + "╯", :color = :BRIGHT_YELLOW, :style = :BOLD])
// Print banner
? ""
for line in banner {
? " " + line
}
? ""
}