remove removeColourCodes function

This commit is contained in:
onyx-and-iris 2026-02-21 15:15:46 +00:00
parent 6d321aa816
commit f552b96737

View File

@ -48,6 +48,8 @@ func (f Flags) Validate() error {
return nil return nil
} }
var reColourCodes = regexp.MustCompile(`\^[0-9]`)
func main() { func main() {
var exitCode int var exitCode int
@ -252,13 +254,6 @@ func runCommand(ctx *context, cmd string) error {
if ctx.sm.Running() { if ctx.sm.Running() {
ctx.sm.Stop() ctx.sm.Stop()
} }
fmt.Print(removeColourCodes(resp)) fmt.Print(reColourCodes.ReplaceAllString(resp, ""))
return nil return nil
} }
var colourCodeRegex = regexp.MustCompile(`\^[0-9]`)
// removeColourCodes removes '\^[0-9]' colour codes from the input string.
func removeColourCodes(s string) string {
return colourCodeRegex.ReplaceAllString(s, "")
}