4 Commits

Author SHA1 Message Date
fd49d432ac upd gitignore 2026-03-30 09:44:51 +01:00
0f96d97fae upd gitignore 2026-03-27 13:54:57 +00:00
54f3c877ed add pre-commit config 2026-03-21 14:03:45 +00:00
f552b96737 remove removeColourCodes function 2026-02-21 15:15:46 +00:00
3 changed files with 19 additions and 12 deletions

15
.gitignore vendored
View File

@@ -1,3 +1,6 @@
# Generated by ignr: github.com/onyx-and-iris/ignr
## Go ##
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
@@ -12,8 +15,11 @@ bin/
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
# Code coverage profiles and other test artifacts
*.out
coverage.*
*.coverprofile
profile.cov
# Dependency directories (remove the comment below to include it)
# vendor/
@@ -26,7 +32,8 @@ go.work.sum
.env
.envrc
# Added by goreleaser init:
dist/
# Editor/IDE
# .idea/
# .vscode/
cmd/codrcon
# End of ignr

5
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.4
hooks:
- id: go-mod-tidy

View File

@@ -48,6 +48,8 @@ func (f Flags) Validate() error {
return nil
}
var reColourCodes = regexp.MustCompile(`\^[0-9]`)
func main() {
var exitCode int
@@ -252,13 +254,6 @@ func runCommand(ctx *context, cmd string) error {
if ctx.sm.Running() {
ctx.sm.Stop()
}
fmt.Print(removeColourCodes(resp))
fmt.Print(reColourCodes.ReplaceAllString(resp, ""))
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, "")
}