0
0
forked from toolshed/abra

wip: fix: deploy status

toolshed/abra#478
This commit is contained in:
2025-01-18 10:01:59 +01:00
parent d09a19a385
commit 8a19536ace
91 changed files with 8991 additions and 204 deletions

15
vendor/github.com/muesli/ansi/.gitignore generated vendored Normal file
View File

@ -0,0 +1,15 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/

27
vendor/github.com/muesli/ansi/.golangci.yml generated vendored Normal file
View File

@ -0,0 +1,27 @@
run:
tests: false
issues:
max-issues-per-linter: 0
max-same-issues: 0
linters:
enable:
- bodyclose
- dupl
- exportloopref
- goconst
- godot
- godox
- goimports
- golint
- goprintffuncname
- gosec
- ifshort
- misspell
- prealloc
- rowserrcheck
- sqlclosecheck
- unconvert
- unparam
- whitespace

21
vendor/github.com/muesli/ansi/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Christian Muehlhaeuser
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.

31
vendor/github.com/muesli/ansi/README.md generated vendored Normal file
View File

@ -0,0 +1,31 @@
# ansi
[![Latest Release](https://img.shields.io/github/release/muesli/ansi.svg)](https://github.com/muesli/ansi/releases)
[![Build Status](https://github.com/muesli/ansi/workflows/build/badge.svg)](https://github.com/muesli/ansi/actions)
[![Coverage Status](https://coveralls.io/repos/github/muesli/ansi/badge.svg?branch=master)](https://coveralls.io/github/muesli/ansi?branch=master)
[![Go ReportCard](https://goreportcard.com/badge/muesli/ansi)](https://goreportcard.com/report/muesli/ansi)
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://pkg.go.dev/github.com/muesli/ansi)
Raw ANSI sequence helpers
## ANSI Writer
```go
import "github.com/muesli/ansi"
w := ansi.Writer{Forward: os.Stdout}
w.Write([]byte("\x1b[31mHello, world!\x1b[0m"))
w.Close()
```
## Compressor
The ANSI compressor eliminates unnecessary/redundant ANSI sequences.
```go
import "github.com/muesli/ansi/compressor"
w := compressor.Writer{Forward: os.Stdout}
w.Write([]byte("\x1b[31mHello, world!\x1b[0m"))
w.Close()
```

7
vendor/github.com/muesli/ansi/ansi.go generated vendored Normal file
View File

@ -0,0 +1,7 @@
package ansi
const Marker = '\x1B'
func IsTerminator(c rune) bool {
return (c >= 0x40 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a)
}

40
vendor/github.com/muesli/ansi/buffer.go generated vendored Normal file
View File

@ -0,0 +1,40 @@
package ansi
import (
"bytes"
"github.com/mattn/go-runewidth"
)
// Buffer is a buffer aware of ANSI escape sequences.
type Buffer struct {
bytes.Buffer
}
// PrintableRuneWidth returns the cell width of all printable runes in the
// buffer.
func (w Buffer) PrintableRuneWidth() int {
return PrintableRuneWidth(w.String())
}
// PrintableRuneWidth returns the cell width of the given string.
func PrintableRuneWidth(s string) int {
var n int
var ansi bool
for _, c := range s {
if c == Marker {
// ANSI escape sequence
ansi = true
} else if ansi {
if IsTerminator(c) {
// ANSI sequence terminated
ansi = false
}
} else {
n += runewidth.RuneWidth(c)
}
}
return n
}

132
vendor/github.com/muesli/ansi/compressor/writer.go generated vendored Normal file
View File

@ -0,0 +1,132 @@
package compressor
import (
"bytes"
"io"
"unicode/utf8"
"github.com/muesli/ansi"
)
type Writer struct {
Forward io.Writer
ansi bool
ansiseq bytes.Buffer
lastseq bytes.Buffer
prevlastseq bytes.Buffer
resetreq bool
runeBuf []byte
compressed int
uncompressed int
}
// Bytes is shorthand for declaring a new default compressor instance,
// used to immediately compress a byte slice.
func Bytes(b []byte) []byte {
var buf bytes.Buffer
f := Writer{
Forward: &buf,
}
_, _ = f.Write(b)
_ = f.Close()
return buf.Bytes()
}
// String is shorthand for declaring a new default compressor instance,
// used to immediately compress a string.
func String(s string) string {
return string(Bytes([]byte(s)))
}
// Write is used to write content to the ANSI buffer.
func (w *Writer) Write(b []byte) (int, error) {
w.uncompressed += len(b)
for _, c := range string(b) {
if c == ansi.Marker {
// ANSI escape sequence
w.ansi = true
_, _ = w.ansiseq.WriteRune(c)
} else if w.ansi {
_, _ = w.ansiseq.WriteRune(c)
if ansi.IsTerminator(c) {
// ANSI sequence terminated
w.ansi = false
terminated := false
if bytes.HasSuffix(w.ansiseq.Bytes(), []byte("[0m")) {
// reset sequence
w.prevlastseq.Reset()
w.prevlastseq.Write(w.lastseq.Bytes())
w.lastseq.Reset()
terminated = true
w.resetreq = true
} else if c == 'm' {
// color code
_, _ = w.lastseq.Write(w.ansiseq.Bytes())
}
if !terminated {
// did we reset the sequence just to restore it again?
if bytes.Equal(w.ansiseq.Bytes(), w.prevlastseq.Bytes()) {
w.resetreq = false
w.ansiseq.Reset()
}
w.prevlastseq.Reset()
if w.resetreq {
w.ResetAnsi()
}
_, _ = w.Forward.Write(w.ansiseq.Bytes())
w.compressed += w.ansiseq.Len()
}
w.ansiseq.Reset()
}
} else {
if w.resetreq {
w.ResetAnsi()
}
_, err := w.writeRune(c)
if err != nil {
return 0, err
}
}
}
return len(b), nil
}
func (w *Writer) writeRune(r rune) (int, error) {
if w.runeBuf == nil {
w.runeBuf = make([]byte, utf8.UTFMax)
}
n := utf8.EncodeRune(w.runeBuf, r)
w.compressed += n
return w.Forward.Write(w.runeBuf[:n])
}
// Close finishes the compression operation. Always call it before trying to
// retrieve the final result.
func (w *Writer) Close() error {
if w.resetreq {
w.ResetAnsi()
}
// log.Println("Written uncompressed: ", w.uncompressed)
// log.Println("Written compressed: ", w.compressed)
return nil
}
func (w *Writer) ResetAnsi() {
w.prevlastseq.Reset()
_, _ = w.Forward.Write([]byte("\x1b[0m"))
w.resetreq = false
}

76
vendor/github.com/muesli/ansi/writer.go generated vendored Normal file
View File

@ -0,0 +1,76 @@
package ansi
import (
"bytes"
"io"
"unicode/utf8"
)
type Writer struct {
Forward io.Writer
ansi bool
ansiseq bytes.Buffer
lastseq bytes.Buffer
seqchanged bool
runeBuf []byte
}
// Write is used to write content to the ANSI buffer.
func (w *Writer) Write(b []byte) (int, error) {
for _, c := range string(b) {
if c == Marker {
// ANSI escape sequence
w.ansi = true
w.seqchanged = true
_, _ = w.ansiseq.WriteRune(c)
} else if w.ansi {
_, _ = w.ansiseq.WriteRune(c)
if IsTerminator(c) {
// ANSI sequence terminated
w.ansi = false
if bytes.HasSuffix(w.ansiseq.Bytes(), []byte("[0m")) {
// reset sequence
w.lastseq.Reset()
w.seqchanged = false
} else if c == 'm' {
// color code
_, _ = w.lastseq.Write(w.ansiseq.Bytes())
}
_, _ = w.ansiseq.WriteTo(w.Forward)
}
} else {
_, err := w.writeRune(c)
if err != nil {
return 0, err
}
}
}
return len(b), nil
}
func (w *Writer) writeRune(r rune) (int, error) {
if w.runeBuf == nil {
w.runeBuf = make([]byte, utf8.UTFMax)
}
n := utf8.EncodeRune(w.runeBuf, r)
return w.Forward.Write(w.runeBuf[:n])
}
func (w *Writer) LastSequence() string {
return w.lastseq.String()
}
func (w *Writer) ResetAnsi() {
if !w.seqchanged {
return
}
_, _ = w.Forward.Write([]byte("\x1b[0m"))
}
func (w *Writer) RestoreAnsi() {
_, _ = w.Forward.Write(w.lastseq.Bytes())
}