diff --git a/asciiarts/asciiart.go b/asciiarts/asciiart.go index 0cc7d81..d66b419 100644 --- a/asciiarts/asciiart.go +++ b/asciiarts/asciiart.go @@ -2,29 +2,19 @@ package asciiarts import ( "embed" - "strings" + "regexp" ) //go:embed *.txt var asciifiles embed.FS func GetAscii(distroID string) string { + regex, _ := regexp.Compile("{[[:upper:]]+}") asciiBuff, error := asciifiles.ReadFile(distroID + ".txt") if error != nil { asciiBuff, _ = asciifiles.ReadFile("unknown.txt") } ascii := string(asciiBuff) - ascii = strings.ReplaceAll(ascii, "{WHITE}", "") - ascii = strings.ReplaceAll(ascii, "{YELLOW}", "") - ascii = strings.ReplaceAll(ascii, "{BLUE}", "") - ascii = strings.ReplaceAll(ascii, "{LPINK}", "") - ascii = strings.ReplaceAll(ascii, "{BACKGROUND_GREEN}", "") - ascii = strings.ReplaceAll(ascii, "{NORMAL}", "") - ascii = strings.ReplaceAll(ascii, "{BLACK}", "") - ascii = strings.ReplaceAll(ascii, "{GREEN}", "") - ascii = strings.ReplaceAll(ascii, "{RED}", "") - ascii = strings.ReplaceAll(ascii, "{PINK}", "") - ascii = strings.ReplaceAll(ascii, "{MAGENTA}", "") - ascii = strings.ReplaceAll(ascii, "{CYAN}", "") + ascii = regex.ReplaceAllString(ascii, "") return ascii }