-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathquick_display.go
55 lines (47 loc) · 2.13 KB
/
quick_display.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
package quick
import (
"fmt"
"net"
)
// ANSI color definition
const (
Reset = "\033[0m"
Blue = "\033[34m"
Green = "\033[32m"
Yellow = "\033[33m"
Cyan = "\033[36m"
Bold = "\033[1m"
)
// Quick version
const QuickVersion = "v0.0.1"
func (q *Quick) Display(scheme, addr string) {
if !q.config.NoBanner {
// Counts the number of registered routes
routeCount := len(q.GetRoute())
// Extract port from addr
host, port, err := net.SplitHostPort(addr)
if err != nil {
fmt.Println("Error separating host and port:", err)
return
}
if len(host) == 0 {
host = "//127.0.0.1"
}
// Display the styled banner
fmt.Println()
fmt.Printf("%s%s ██████╗ ██╗ ██╗██╗ ██████╗██╗ ██╗%s\n", Bold, Blue, Reset)
fmt.Printf("%s ██╔═══██╗██║ ██║██║██╔═══ ██║ ██╔╝%s\n", Blue, Reset)
fmt.Printf("%s ██║ ██║██║ ██║██║██║ █████╔╝ %s\n", Blue, Reset)
fmt.Printf("%s ██║▄▄ ██║██║ ██║██║██║ ██╔═██╗ %s\n", Blue, Reset)
fmt.Printf("%s ╚██████╔╝╚██████╔╝██║╚██████╔ ██║ ██╗%s\n", Blue, Reset)
fmt.Printf("%s ╚══▀▀═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝%s\n", Blue, Reset)
fmt.Println()
fmt.Printf("%s%s Quick %s %s🚀 Fast & Minimal Web Framework%s\n", Bold, Cyan, QuickVersion, Yellow, Reset)
fmt.Println("─────────────────── ───────────────────────────────")
fmt.Printf("%s 🌎 Host : %s%s:%s%s\n", Yellow, Green, scheme, host, Reset)
fmt.Printf("%s 📌 Port : %s%s%s\n", Yellow, Green, port, Reset)
fmt.Printf("%s 🔀 Routes: %s%d%s\n", Yellow, Green, routeCount, Reset)
fmt.Println("─────────────────── ───────────────────────────────")
fmt.Println()
}
}