summaryrefslogtreecommitdiffstats
path: root/dependencies/pkg/mod/github.com/acarl005
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:36:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:36:04 +0000
commitb09c6d56832eb1718c07d74abf3bc6ae3fe4e030 (patch)
treed2caec2610d4ea887803ec9e9c3cd77136c448ba /dependencies/pkg/mod/github.com/acarl005
parentInitial commit. (diff)
downloadicingadb-b09c6d56832eb1718c07d74abf3bc6ae3fe4e030.tar.xz
icingadb-b09c6d56832eb1718c07d74abf3bc6ae3fe4e030.zip
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/LICENSE21
-rw-r--r--dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/README.md30
-rw-r--r--dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/stripansi.go13
3 files changed, 64 insertions, 0 deletions
diff --git a/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/LICENSE b/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/LICENSE
new file mode 100644
index 0000000..00abe0d
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Andrew Carlson
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/README.md b/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/README.md
new file mode 100644
index 0000000..8bdb1f5
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/README.md
@@ -0,0 +1,30 @@
+Strip ANSI
+==========
+
+This Go package removes ANSI escape codes from strings.
+
+Ideally, we would prevent these from appearing in any text we want to process.
+However, sometimes this can't be helped, and we need to be able to deal with that noise.
+This will use a regexp to remove those unwanted escape codes.
+
+
+## Install
+
+```sh
+$ go get -u github.com/acarl005/stripansi
+```
+
+## Usage
+
+```go
+import (
+ "fmt"
+ "github.com/acarl005/stripansi"
+)
+
+func main() {
+ msg := "\x1b[38;5;140m foo\x1b[0m bar"
+ cleanMsg := stripansi.Strip(msg)
+ fmt.Println(cleanMsg) // " foo bar"
+}
+```
diff --git a/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/stripansi.go b/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/stripansi.go
new file mode 100644
index 0000000..235732a
--- /dev/null
+++ b/dependencies/pkg/mod/github.com/acarl005/stripansi@v0.0.0-20180116102854-5a71ef0e047d/stripansi.go
@@ -0,0 +1,13 @@
+package stripansi
+
+import (
+ "regexp"
+)
+
+const ansi = "[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
+
+var re = regexp.MustCompile(ansi)
+
+func Strip(str string) string {
+ return re.ReplaceAllString(str, "")
+}