creation du build 0.0.0.25

This commit is contained in:
bruno 2023-06-30 10:08:50 -04:00
parent 7c24456629
commit 3be0c4d9f6
1 changed files with 29 additions and 5 deletions

View File

@ -37,10 +37,6 @@ func PrintHelpFormated(version string, author string, buildDate string, cmd *cob
fmt.Println("") fmt.Println("")
PrintVersion(version, author, buildDate) PrintVersion(version, author, buildDate)
// color.Yellow.Println(CreateLine(15))
// color.Green.Println("| Version: " + version + " || Author: " + author + " || Build date: " + buildDate + " |")
// color.Yellow.Println(CreateLine(15))
// fmt.Println("")
} }
func PrintVersion(version string, author string, buildDate string) { func PrintVersion(version string, author string, buildDate string) {
@ -58,7 +54,7 @@ func BytesToStrings(bytes []byte) []string {
return strings return strings
} }
func GetGitToken() string { func GetGitTokenFromOsEnv() string {
token := os.Getenv("GIT_TOKEN") token := os.Getenv("GIT_TOKEN")
return token return token
} }
@ -123,7 +119,35 @@ func PadString(s string, n int) string {
return s + strings.Repeat(" ", n-len(s)) return s + strings.Repeat(" ", n-len(s))
} }
func PadDotString(s string, n int) string {
if len(s) >= n {
return s
}
return s + strings.Repeat(".", n-len(s))
}
// function to print 3 elements on a line
func PrintTreeElement(e1 int, e2 string, e3 string) {
fmt.Printf("[ %02d ] %s [ %s ]\n", e1, ColorizeString(PadDotString(e2, 35), color.Green), ColorizeString(e3, color.LightWhite))
}
// function format 3 elements on a line
func FormatTreeElement(e1 int, e2 string, e3 string) string {
return fmt.Sprintf("[ %02d ] %s [ %s ]\n", e1, ColorizeString(PadDotString(e2, 35), color.Green), ColorizeString(e3, color.LightWhite))
}
// function that return a string with a specific color
func ColorizeString(s string, color color.Color) string {
return color.Sprint(s)
}
// function that color in red sub-trings in a string // function that color in red sub-trings in a string
func ColorizeSubStrRed(s string, sub string) string { func ColorizeSubStrRed(s string, sub string) string {
return strings.Replace(s, sub, color.Red.Sprint(sub), -1) return strings.Replace(s, sub, color.Red.Sprint(sub), -1)
} }
// function that double backslash in a string
func DoubleBackSlash(s string) string {
return strings.Replace(s, "\\", "\\\\", -1)
}