-
-
Notifications
You must be signed in to change notification settings - Fork 242
/
Copy pathinfo.go
64 lines (53 loc) · 2.34 KB
/
info.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
package internal
import (
"fmt"
"strings"
"github.com/fatih/color"
)
// Identifier is the unique identifier for the Permify.
var Identifier = ""
/*
✨ OneLiner: Open-source authorization service inspired by Google Zanzibar
📚 Docs: https://docs.permify.co
🐙 GitHub: https://github.com/Permify/permify
📝 Blog: https://permify.co/blog
💬 Discord: https://discord.gg/n6KfzYxhPp
🐦 Twitter: https://twitter.com/GetPermify
💼 LinkedIn: https://www.linkedin.com/company/permifyco
*/
const (
// Version is the last release of the Permify (e.g. v0.1.0)
Version = "v1.2.8"
)
// Function to create a single line of the ASCII art with centered content and color
func createLine(content string, totalWidth int, borderColor, contentColor *color.Color) string {
contentLength := len(content)
paddingWidth := (totalWidth - contentLength - 4) / 2
if paddingWidth < 0 {
paddingWidth = 0
}
leftPadding := strings.Repeat(" ", paddingWidth)
rightPadding := strings.Repeat(" ", totalWidth-2-contentLength-paddingWidth)
border := borderColor.Sprint("│")
contentWithColor := contentColor.Sprintf("%s%s%s", leftPadding, content, rightPadding)
return fmt.Sprintf("%s%s%s", border, contentWithColor, border)
}
func PrintBanner() {
borderColor := color.New(color.FgWhite)
contentColor := color.New(color.FgWhite)
versionInfo := fmt.Sprintf("Permify %s", Version)
lines := []string{
borderColor.Sprint("┌────────────────────────────────────────────────────────┐"),
createLine(versionInfo, 58, borderColor, color.New(color.FgBlue)),
createLine("Fine-grained Authorization Service", 58, borderColor, contentColor),
createLine("", 58, borderColor, contentColor),
createLine("docs: ............... https://docs.permify.co", 58, borderColor, contentColor),
createLine("github: .. https://github.com/Permify/permify", 58, borderColor, contentColor),
createLine("blog: ............... https://permify.co/blog", 58, borderColor, contentColor),
createLine("", 58, borderColor, contentColor),
borderColor.Sprint("└────────────────────────────────────────────────────────┘"),
}
for _, line := range lines {
fmt.Println(line)
}
}