neowofetch/asciiarts/asciiart.go

21 lines
399 B
Go
Raw Normal View History

2022-09-25 20:50:20 +02:00
package asciiarts
import (
"embed"
"regexp"
2022-09-25 20:50:20 +02:00
)
//go:embed *.txt
var asciifiles embed.FS
2022-09-25 20:50:20 +02:00
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 = regex.ReplaceAllString(ascii, "")
2022-09-25 20:50:20 +02:00
return ascii
}