Merge pull request #1583 from crazy-max/dependabot/go_modules/github.com/jedib0t/go-pretty/v6-6.7.8

chore(deps): bump github.com/jedib0t/go-pretty/v6 from 6.7.7 to 6.7.8
This commit is contained in:
CrazyMax
2025-12-24 12:24:14 +01:00
committed by GitHub
10 changed files with 32 additions and 27 deletions

2
go.mod
View File

@@ -21,7 +21,7 @@ require (
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
github.com/go-playground/validator/v10 v10.30.0
github.com/hashicorp/nomad/api v0.0.0-20251209201056-5b76eb053561 // v1.11.1
github.com/jedib0t/go-pretty/v6 v6.7.7
github.com/jedib0t/go-pretty/v6 v6.7.8
github.com/matcornic/hermes/v2 v2.1.0
github.com/microcosm-cc/bluemonday v1.0.27
github.com/moby/buildkit v0.26.3

4
go.sum
View File

@@ -191,8 +191,8 @@ github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 h1:xqgexXAGQgY3HAjNPSaCqn5Aahbo5TKsmhp8VRfr1iQ=
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
github.com/jedib0t/go-pretty/v6 v6.7.7 h1:Y1Id3lJ3k4UB8uwWWy3l8EVFnUlx5chR5+VbsofPNX0=
github.com/jedib0t/go-pretty/v6 v6.7.7/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
github.com/jedib0t/go-pretty/v6 v6.7.8 h1:BVYrDy5DPBA3Qn9ICT+PokP9cvCv1KaHv2i+Hc8sr5o=
github.com/jedib0t/go-pretty/v6 v6.7.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=

View File

@@ -36,11 +36,11 @@ func (t *Table) RenderCSV() string {
}
func (t *Table) csvFixCommas(str string) string {
return strings.Replace(str, ",", "\\,", -1)
return strings.ReplaceAll(str, ",", "\\,")
}
func (t *Table) csvFixDoubleQuotes(str string) string {
return strings.Replace(str, "\"", "\\\"", -1)
return strings.ReplaceAll(str, "\"", "\\\"")
}
func (t *Table) csvRenderRow(out *strings.Builder, row rowStr, hint renderHint) {
@@ -54,7 +54,7 @@ func (t *Table) csvRenderRow(out *strings.Builder, row rowStr, hint renderHint)
// auto-index column
if colIdx == 0 && t.autoIndex {
if hint.isRegularRow() {
out.WriteString(fmt.Sprint(hint.rowNumber))
fmt.Fprint(out, hint.rowNumber)
}
out.WriteRune(',')
}

View File

@@ -151,7 +151,7 @@ func (t *Table) htmlRenderColumnAutoIndex(out *strings.Builder, hint renderHint)
out.WriteString("</td>\n")
} else {
out.WriteString(" <td align=\"right\">")
out.WriteString(fmt.Sprint(hint.rowNumber))
fmt.Fprint(out, hint.rowNumber)
out.WriteString("</td>\n")
}
}
@@ -191,10 +191,10 @@ func (t *Table) htmlRenderRow(out *strings.Builder, row rowStr, hint renderHint)
t.htmlRenderColumnAttributes(out, colIdx, hint, align)
if extraColumnsRendered > 0 {
out.WriteString(" colspan=")
out.WriteString(fmt.Sprint(extraColumnsRendered + 1))
fmt.Fprint(out, extraColumnsRendered+1)
} else if rowSpan := t.shouldMergeCellsVerticallyBelow(colIdx, hint); rowSpan > 1 {
out.WriteString(" rowspan=")
out.WriteString(fmt.Sprint(rowSpan))
fmt.Fprint(out, rowSpan)
}
out.WriteString(">")
if len(colStr) == 0 {

View File

@@ -66,7 +66,7 @@ func (t *Table) markdownRenderRowAutoIndex(out *strings.Builder, colIdx int, hin
if hint.isSeparatorRow {
out.WriteString("---:")
} else if hint.isRegularRow() {
out.WriteString(fmt.Sprintf("%d ", hint.rowNumber))
fmt.Fprintf(out, "%d ", hint.rowNumber)
}
out.WriteRune('|')
}

View File

@@ -40,7 +40,7 @@ func (t *Table) tsvRenderRow(out *strings.Builder, row rowStr, hint renderHint)
for idx, col := range row {
if idx == 0 && t.autoIndex {
if hint.isRegularRow() {
out.WriteString(fmt.Sprint(hint.rowNumber))
fmt.Fprint(out, hint.rowNumber)
}
out.WriteRune('\t')
}
@@ -51,7 +51,7 @@ func (t *Table) tsvRenderRow(out *strings.Builder, row rowStr, hint renderHint)
if strings.ContainsAny(col, "\t\n\"") || strings.Contains(col, " ") {
col = strings.ReplaceAll(col, "\"", "\"\"") // fix double-quotes
out.WriteString(fmt.Sprintf("\"%s\"", col))
fmt.Fprintf(out, "\"%s\"", col)
} else {
out.WriteString(col)
}

View File

@@ -15,18 +15,22 @@ var ANSICodesSupported = areANSICodesSupported()
// Escape("Nymeria\x1b[94mGhost\x1b[0mLady", "\x1b[91m") == "\x1b[91mNymeria\x1b[94mGhost\x1b[0m\x1b[91mLady\x1b[0m"
// Escape("Nymeria \x1b[94mGhost\x1b[0m Lady", "\x1b[91m") == "\x1b[91mNymeria \x1b[94mGhost\x1b[0m\x1b[91m Lady\x1b[0m"
func Escape(str string, escapeSeq string) string {
out := ""
var out strings.Builder
// Estimate capacity: original string + escape sequences
out.Grow(len(str) + len(escapeSeq)*3 + len(EscapeReset)*2)
if !strings.HasPrefix(str, EscapeStart) {
out += escapeSeq
out.WriteString(escapeSeq)
}
out += strings.Replace(str, EscapeReset, EscapeReset+escapeSeq, -1)
if !strings.HasSuffix(out, EscapeReset) {
out += EscapeReset
out.WriteString(strings.ReplaceAll(str, EscapeReset, EscapeReset+escapeSeq))
if !strings.HasSuffix(out.String(), EscapeReset) {
out.WriteString(EscapeReset)
}
if strings.Contains(out, escapeSeq+EscapeReset) {
out = strings.Replace(out, escapeSeq+EscapeReset, "", -1)
result := out.String()
if strings.Contains(result, escapeSeq+EscapeReset) {
result = strings.ReplaceAll(result, escapeSeq+EscapeReset, "")
}
return out
return result
}
// StripEscape strips all ANSI Escape Sequence from the string.

View File

@@ -27,10 +27,11 @@ func (va VAlign) Apply(lines []string, maxLines int) []string {
maxLines = len(lines)
}
insertIdx := 0
if va == VAlignMiddle {
var insertIdx int
switch va {
case VAlignMiddle:
insertIdx = int(maxLines-len(lines)) / 2
} else if va == VAlignBottom {
case VAlignBottom:
insertIdx = maxLines - len(lines)
}

View File

@@ -13,7 +13,7 @@ func WrapHard(str string, wrapLen int) string {
if wrapLen <= 0 {
return ""
}
str = strings.Replace(str, "\t", " ", -1)
str = strings.ReplaceAll(str, "\t", " ")
sLen := StringWidthWithoutEscSequences(str)
if sLen <= wrapLen {
return str
@@ -41,7 +41,7 @@ func WrapSoft(str string, wrapLen int) string {
if wrapLen <= 0 {
return ""
}
str = strings.Replace(str, "\t", " ", -1)
str = strings.ReplaceAll(str, "\t", " ")
sLen := StringWidthWithoutEscSequences(str)
if sLen <= wrapLen {
return str
@@ -68,7 +68,7 @@ func WrapText(str string, wrapLen int) string {
if wrapLen <= 0 {
return ""
}
str = strings.Replace(str, "\t", " ", -1)
str = strings.ReplaceAll(str, "\t", " ")
sLen := StringWidthWithoutEscSequences(str)
if sLen <= wrapLen {
return str

2
vendor/modules.txt vendored
View File

@@ -254,7 +254,7 @@ github.com/imdario/mergo
# github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0
## explicit
github.com/jaytaylor/html2text
# github.com/jedib0t/go-pretty/v6 v6.7.7
# github.com/jedib0t/go-pretty/v6 v6.7.8
## explicit; go 1.18
github.com/jedib0t/go-pretty/v6/table
github.com/jedib0t/go-pretty/v6/text