local programmer doesnt know what regex is
This commit is contained in:
parent
f9b371f83b
commit
95b9f7d3f3
1 changed files with 3 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue