mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
This reverts commit bba7c23957.
This commit is contained in:
2
vendor/github.com/tidwall/pretty/README.md
generated
vendored
2
vendor/github.com/tidwall/pretty/README.md
generated
vendored
@@ -59,7 +59,7 @@ Will format the json to:
|
||||
|
||||
Color will colorize the json for outputing to the screen.
|
||||
|
||||
```go
|
||||
```json
|
||||
result = pretty.Color(json, nil)
|
||||
```
|
||||
|
||||
|
||||
22
vendor/github.com/tidwall/pretty/pretty.go
generated
vendored
22
vendor/github.com/tidwall/pretty/pretty.go
generated
vendored
@@ -422,7 +422,6 @@ type Style struct {
|
||||
Key, String, Number [2]string
|
||||
True, False, Null [2]string
|
||||
Escape [2]string
|
||||
Brackets [2]string
|
||||
Append func(dst []byte, c byte) []byte
|
||||
}
|
||||
|
||||
@@ -440,14 +439,13 @@ var TerminalStyle *Style
|
||||
|
||||
func init() {
|
||||
TerminalStyle = &Style{
|
||||
Key: [2]string{"\x1B[1m\x1B[94m", "\x1B[0m"},
|
||||
String: [2]string{"\x1B[32m", "\x1B[0m"},
|
||||
Number: [2]string{"\x1B[33m", "\x1B[0m"},
|
||||
True: [2]string{"\x1B[36m", "\x1B[0m"},
|
||||
False: [2]string{"\x1B[36m", "\x1B[0m"},
|
||||
Null: [2]string{"\x1B[2m", "\x1B[0m"},
|
||||
Escape: [2]string{"\x1B[35m", "\x1B[0m"},
|
||||
Brackets: [2]string{"\x1B[1m", "\x1B[0m"},
|
||||
Key: [2]string{"\x1B[94m", "\x1B[0m"},
|
||||
String: [2]string{"\x1B[92m", "\x1B[0m"},
|
||||
Number: [2]string{"\x1B[93m", "\x1B[0m"},
|
||||
True: [2]string{"\x1B[96m", "\x1B[0m"},
|
||||
False: [2]string{"\x1B[96m", "\x1B[0m"},
|
||||
Null: [2]string{"\x1B[91m", "\x1B[0m"},
|
||||
Escape: [2]string{"\x1B[35m", "\x1B[0m"},
|
||||
Append: func(dst []byte, c byte) []byte {
|
||||
if c < ' ' && (c != '\r' && c != '\n' && c != '\t' && c != '\v') {
|
||||
dst = append(dst, "\\u00"...)
|
||||
@@ -541,19 +539,13 @@ func Color(src []byte, style *Style) []byte {
|
||||
}
|
||||
} else if src[i] == '{' || src[i] == '[' {
|
||||
stack = append(stack, stackt{src[i], src[i] == '{'})
|
||||
dst = append(dst, style.Brackets[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
dst = append(dst, style.Brackets[1]...)
|
||||
} else if (src[i] == '}' || src[i] == ']') && len(stack) > 0 {
|
||||
stack = stack[:len(stack)-1]
|
||||
dst = append(dst, style.Brackets[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
dst = append(dst, style.Brackets[1]...)
|
||||
} else if (src[i] == ':' || src[i] == ',') && len(stack) > 0 && stack[len(stack)-1].kind == '{' {
|
||||
stack[len(stack)-1].key = !stack[len(stack)-1].key
|
||||
dst = append(dst, style.Brackets[0]...)
|
||||
dst = apnd(dst, src[i])
|
||||
dst = append(dst, style.Brackets[1]...)
|
||||
} else {
|
||||
var kind byte
|
||||
if (src[i] >= '0' && src[i] <= '9') || src[i] == '-' || isNaNOrInf(src[i:]) {
|
||||
|
||||
Reference in New Issue
Block a user