mirror of
https://github.com/onyx-and-iris/q3rcon.git
synced 2026-04-20 00:33:31 +00:00
Compare commits
4 Commits
6d321aa816
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| fd49d432ac | |||
| 0f96d97fae | |||
| 54f3c877ed | |||
| f552b96737 |
15
.gitignore
vendored
15
.gitignore
vendored
@@ -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
5
.pre-commit-config.yaml
Normal 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
|
||||
@@ -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, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user