diff --git a/go.mod b/go.mod index 7fef23f909..63e01b1fb3 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 - github.com/jedib0t/go-pretty/v6 v6.5.8 + github.com/jedib0t/go-pretty/v6 v6.5.9 github.com/kbinani/screenshot v0.0.0-20191211154542-3a185f1ce18f github.com/klauspost/compress v1.17.8 github.com/lesnuages/go-winio v0.4.19 diff --git a/go.sum b/go.sum index 25acc158f8..0b4efd2fdd 100644 --- a/go.sum +++ b/go.sum @@ -221,8 +221,8 @@ github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jedib0t/go-pretty/v6 v6.5.8 h1:8BCzJdSvUbaDuRba4YVh+SKMGcAAKdkcF3SVFbrHAtQ= -github.com/jedib0t/go-pretty/v6 v6.5.8/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= +github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= github.com/jellydator/ttlcache/v3 v3.1.0 h1:0gPFG0IHHP6xyUyXq+JaD8fwkDCqgqwohXNJBcYE71g= github.com/jellydator/ttlcache/v3 v3.1.0/go.mod h1:hi7MGFdMAwZna5n2tuvh63DvFLzVKySzCVW6+0gA2n4= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= diff --git a/vendor/github.com/jedib0t/go-pretty/v6/table/README.md b/vendor/github.com/jedib0t/go-pretty/v6/table/README.md index a9813bb818..e7d3e1b76a 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/table/README.md +++ b/vendor/github.com/jedib0t/go-pretty/v6/table/README.md @@ -7,9 +7,9 @@ Pretty-print tables into ASCII/Unicode strings. - Add Header(s) and Footer(s) (`AppendHeader`/`AppendFooter`) - Add a Separator manually after any Row (`AppendSeparator`) - Auto Index Rows (1, 2, 3 ...) and Columns (A, B, C, ...) (`SetAutoIndex`) - - Auto Merge (_not supported in CSV/HTML/Markdown/TSV modes_) + - Auto Merge (_not supported in CSV/Markdown/TSV modes_) - Cells in a Row (`RowConfig.AutoMerge`) - - Columns (`ColumnConfig.AutoMerge`) + - Columns (`ColumnConfig.AutoMerge`) (_not supported in HTML mode_) - Limit the length of - Rows (`SetAllowedRowLength`) - Columns (`ColumnConfig.Width*`) diff --git a/vendor/github.com/jedib0t/go-pretty/v6/table/render_html.go b/vendor/github.com/jedib0t/go-pretty/v6/table/render_html.go index fcea86bc99..decf4fa0db 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/table/render_html.go +++ b/vendor/github.com/jedib0t/go-pretty/v6/table/render_html.go @@ -4,6 +4,8 @@ import ( "fmt" "html" "strings" + + "github.com/jedib0t/go-pretty/v6/text" ) const ( @@ -113,9 +115,9 @@ func (t *Table) htmlRenderColumn(out *strings.Builder, colStr string) { out.WriteString(colStr) } -func (t *Table) htmlRenderColumnAttributes(out *strings.Builder, colIdx int, hint renderHint) { +func (t *Table) htmlRenderColumnAttributes(out *strings.Builder, colIdx int, hint renderHint, alignOverride text.Align) { // determine the HTML "align"/"valign" property values - align := t.getAlign(colIdx, hint).HTMLProperty() + align := alignOverride.HTMLProperty() vAlign := t.getVAlign(colIdx, hint).HTMLProperty() // determine the HTML "class" property values for the colors class := t.getColumnColors(colIdx, hint).HTMLProperty() @@ -158,11 +160,31 @@ func (t *Table) htmlRenderRow(out *strings.Builder, row rowStr, hint renderHint) t.htmlRenderColumnAutoIndex(out, hint) } + align := t.getAlign(colIdx, hint) + rowConfig := t.getRowConfig(hint) + extraColumnsRendered := 0 + if rowConfig.AutoMerge && !hint.isSeparatorRow { + // get the real row to consider all lines in each column instead of just + // looking at the current "line" + rowUnwrapped := t.getRow(hint.rowNumber-1, hint) + for idx := colIdx + 1; idx < len(rowUnwrapped); idx++ { + if rowUnwrapped[colIdx] != rowUnwrapped[idx] { + break + } + align = rowConfig.getAutoMergeAlign() + extraColumnsRendered++ + } + } + colStr, colTagName := t.htmlGetColStrAndTag(row, colIdx, hint) // write the row out.WriteString(" <") out.WriteString(colTagName) - t.htmlRenderColumnAttributes(out, colIdx, hint) + t.htmlRenderColumnAttributes(out, colIdx, hint, align) + if extraColumnsRendered > 0 { + out.WriteString(" colspan=") + out.WriteString(fmt.Sprint(extraColumnsRendered + 1)) + } out.WriteString(">") if len(colStr) == 0 { out.WriteString(t.style.HTML.EmptyColumn) @@ -172,6 +194,7 @@ func (t *Table) htmlRenderRow(out *strings.Builder, row rowStr, hint renderHint) out.WriteString("\n") + colIdx += extraColumnsRendered } out.WriteString(" \n") } diff --git a/vendor/modules.txt b/vendor/modules.txt index ea0dcfe365..91b02d22bb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -440,7 +440,7 @@ github.com/jackc/puddle/v2/internal/genstack ## explicit github.com/jcmturner/gofork/encoding/asn1 github.com/jcmturner/gofork/x/crypto/pbkdf2 -# github.com/jedib0t/go-pretty/v6 v6.5.8 +# github.com/jedib0t/go-pretty/v6 v6.5.9 ## explicit; go 1.17 github.com/jedib0t/go-pretty/v6/table github.com/jedib0t/go-pretty/v6/text