-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.go
56 lines (55 loc) · 1.19 KB
/
helpers.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
package main
import (
"fmt"
"strings"
)
var (
Info = Teal
Warn = Yellow
Fata = Red
Gree = Green
Purp = Purple
)
var (
Black = Color("\033[1;30m%s\033[0m")
Red = Color("\033[1;31m%s\033[0m")
Green = Color("\033[1;32m%s\033[0m")
Yellow = Color("\033[1;33m%s\033[0m")
Purple = Color("\033[1;34m%s\033[0m")
Magenta = Color("\033[1;35m%s\033[0m")
Teal = Color("\033[1;36m%s\033[0m")
White = Color("\033[1;37m%s\033[0m")
)
func Color(colorString string) func(...interface{}) string {
sprint := func(args ...interface{}) string {
return fmt.Sprintf(colorString,
fmt.Sprint(args...))
}
return sprint
}
func clearinput(input string) string {
var cleartext = strings.Replace(input, "\n", "", -1)
return cleartext
}
func completingstring(input string) string {
var str strings.Builder
str.WriteString(input)
for len(str.String()) <= 24 {
str.WriteString("(A)")
}
//this char can be var
return str.String()
}
func cleanstring(s string) string {
result := strings.ReplaceAll(s, "(A)", "")
resulta := strings.ReplaceAll(result, "(", "")
return resulta
}
func contains(arr []string, str string) bool {
for _, a := range arr {
if a == str {
return true
}
}
return false
}