From 87b781bc47b5c561f2db87f06cea1e25cec3abd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 09:24:37 +0000 Subject: [PATCH] build(deps): bump github.com/jedib0t/go-pretty/v6 from 6.7.8 to 6.7.9 Bumps [github.com/jedib0t/go-pretty/v6](https://github.com/jedib0t/go-pretty) from 6.7.8 to 6.7.9. - [Release notes](https://github.com/jedib0t/go-pretty/releases) - [Commits](https://github.com/jedib0t/go-pretty/compare/v6.7.8...v6.7.9) --- updated-dependencies: - dependency-name: github.com/jedib0t/go-pretty/v6 dependency-version: 6.7.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../go-pretty/v6/table/render_markdown.go | 46 ++++++++++++++++--- .../jedib0t/go-pretty/v6/table/style.go | 17 +++---- .../go-pretty/v6/table/style_markdown.go | 25 ++++++++++ .../jedib0t/go-pretty/v6/text/align.go | 18 ++++++-- vendor/modules.txt | 2 +- 7 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 vendor/github.com/jedib0t/go-pretty/v6/table/style_markdown.go diff --git a/go.mod b/go.mod index 0d1aa768..1b11be7f 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/gin-gonic/gin v1.12.0 github.com/go-logr/logr v1.4.3 github.com/go-logr/stdr v1.2.2 - github.com/jedib0t/go-pretty/v6 v6.7.8 + github.com/jedib0t/go-pretty/v6 v6.7.9 github.com/kubeservice-stack/common v1.9.1 github.com/mholt/archiver/v4 v4.0.0-alpha.9 github.com/oklog/run v1.2.0 diff --git a/go.sum b/go.sum index 821828bb..c662a2fc 100644 --- a/go.sum +++ b/go.sum @@ -273,8 +273,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyf github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -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/jedib0t/go-pretty/v6 v6.7.9 h1:frarzQWmkZd97syT81+TH8INKPpzoxQnk+Mk5EIHSrM= +github.com/jedib0t/go-pretty/v6 v6.7.9/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/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= diff --git a/vendor/github.com/jedib0t/go-pretty/v6/table/render_markdown.go b/vendor/github.com/jedib0t/go-pretty/v6/table/render_markdown.go index ff298b1f..d7227d36 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/table/render_markdown.go +++ b/vendor/github.com/jedib0t/go-pretty/v6/table/render_markdown.go @@ -51,22 +51,49 @@ func (t *Table) markdownRenderRow(out *strings.Builder, row rowStr, hint renderH if colIdx < len(row) { colStr = row[colIdx] } - out.WriteRune(' ') colStr = strings.ReplaceAll(colStr, "|", "\\|") colStr = strings.ReplaceAll(colStr, "\n", "
") - out.WriteString(colStr) - out.WriteRune(' ') + if t.style.Markdown.PadContent { + out.WriteRune(' ') + align := t.getAlign(colIdx, hint) + out.WriteString(align.Apply(colStr, t.maxColumnLengths[colIdx])) + out.WriteRune(' ') + } else { + out.WriteRune(' ') + out.WriteString(colStr) + out.WriteRune(' ') + } out.WriteRune('|') } } func (t *Table) markdownRenderRowAutoIndex(out *strings.Builder, colIdx int, hint renderHint) { if colIdx == 0 && t.autoIndex { - out.WriteRune(' ') if hint.isSeparatorRow { - out.WriteString("---:") + if t.style.Markdown.PadContent { + out.WriteString(" " + strings.Repeat("-", t.autoIndexVIndexMaxLength) + ":") + } else { + out.WriteRune(' ') + out.WriteString("---:") + } } else if hint.isRegularRow() { - fmt.Fprintf(out, "%d ", hint.rowNumber) + if t.style.Markdown.PadContent { + rowNumStr := fmt.Sprint(hint.rowNumber) + out.WriteRune(' ') + fmt.Fprintf(out, "%*s", t.autoIndexVIndexMaxLength, rowNumStr) + out.WriteRune(' ') + } else { + out.WriteRune(' ') + fmt.Fprintf(out, "%d ", hint.rowNumber) + } + } else { + if t.style.Markdown.PadContent { + out.WriteRune(' ') + out.WriteString(strings.Repeat(" ", t.autoIndexVIndexMaxLength)) + out.WriteRune(' ') + } else { + out.WriteRune(' ') + } } out.WriteRune('|') } @@ -107,7 +134,12 @@ func (t *Table) markdownRenderSeparator(out *strings.Builder, hint renderHint) { for colIdx := 0; colIdx < t.numColumns; colIdx++ { t.markdownRenderRowAutoIndex(out, colIdx, hint) - out.WriteString(t.getAlign(colIdx, hint).MarkdownProperty()) + align := t.getAlign(colIdx, hint) + if t.style.Markdown.PadContent { + out.WriteString(align.MarkdownProperty(t.maxColumnLengths[colIdx])) + } else { + out.WriteString(align.MarkdownProperty()) + } out.WriteRune('|') } } diff --git a/vendor/github.com/jedib0t/go-pretty/v6/table/style.go b/vendor/github.com/jedib0t/go-pretty/v6/table/style.go index b5f58493..0b2473de 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/table/style.go +++ b/vendor/github.com/jedib0t/go-pretty/v6/table/style.go @@ -3,14 +3,15 @@ package table // Style declares how to render the Table and provides very fine-grained control // on how the Table gets rendered on the Console. type Style struct { - Name string // name of the Style - Box BoxStyle // characters to use for the boxes - Color ColorOptions // colors to use for the rows and columns - Format FormatOptions // formatting options for the rows and columns - HTML HTMLOptions // rendering options for HTML mode - Options Options // misc. options for the table - Size SizeOptions // size (width) options for the table - Title TitleOptions // formation options for the title text + Name string // name of the Style + Box BoxStyle // characters to use for the boxes + Color ColorOptions // colors to use for the rows and columns + Format FormatOptions // formatting options for the rows and columns + HTML HTMLOptions // rendering options for HTML mode + Markdown MarkdownOptions // rendering options for Markdown mode + Options Options // misc. options for the table + Size SizeOptions // size (width) options for the table + Title TitleOptions // formation options for the title text } var ( diff --git a/vendor/github.com/jedib0t/go-pretty/v6/table/style_markdown.go b/vendor/github.com/jedib0t/go-pretty/v6/table/style_markdown.go new file mode 100644 index 00000000..a4c6632c --- /dev/null +++ b/vendor/github.com/jedib0t/go-pretty/v6/table/style_markdown.go @@ -0,0 +1,25 @@ +package table + +// MarkdownOptions defines options to control Markdown rendering. +type MarkdownOptions struct { + // PadContent pads each column content to match the longest content in + // the column, and extends the separator dashes to match. This makes the + // raw Markdown source more readable without affecting the rendered + // output. + // + // When disabled (default): + // | # | First Name | Last Name | Salary | | + // | ---:| --- | --- | ---:| --- | + // | 1 | Arya | Stark | 3000 | | + // + // When enabled: + // | # | First Name | Last Name | Salary | | + // | ---:| ---------- | --------- | ------:| --------------------------- | + // | 1 | Arya | Stark | 3000 | | + PadContent bool +} + +var ( + // DefaultMarkdownOptions defines sensible Markdown rendering defaults. + DefaultMarkdownOptions = MarkdownOptions{} +) diff --git a/vendor/github.com/jedib0t/go-pretty/v6/text/align.go b/vendor/github.com/jedib0t/go-pretty/v6/text/align.go index 189531dc..33512ee8 100644 --- a/vendor/github.com/jedib0t/go-pretty/v6/text/align.go +++ b/vendor/github.com/jedib0t/go-pretty/v6/text/align.go @@ -76,16 +76,24 @@ func (a Align) HTMLProperty() string { } // MarkdownProperty returns the equivalent Markdown horizontal-align separator. -func (a Align) MarkdownProperty() string { +// An optional minLength can be provided to extend the dashes to match the +// column content width; the result will be max(minLength, 3)+2 wide (including +// leading/trailing space or colon). Without minLength (or 0), it defaults to 3. +func (a Align) MarkdownProperty(minLength ...int) string { + length := 3 + if len(minLength) > 0 && minLength[0] > length { + length = minLength[0] + } + dashes := strings.Repeat("-", length) switch a { case AlignLeft: - return ":--- " + return ":" + dashes + " " case AlignCenter: - return ":---:" + return ":" + dashes + ":" case AlignRight: - return " ---:" + return " " + dashes + ":" default: - return " --- " + return " " + dashes + " " } } diff --git a/vendor/modules.txt b/vendor/modules.txt index d58d0908..1db76660 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -379,7 +379,7 @@ github.com/hashicorp/golang-lru/v2/simplelru # github.com/inconshreveable/mousetrap v1.1.0 ## explicit; go 1.18 github.com/inconshreveable/mousetrap -# github.com/jedib0t/go-pretty/v6 v6.7.8 +# github.com/jedib0t/go-pretty/v6 v6.7.9 ## explicit; go 1.18 github.com/jedib0t/go-pretty/v6/table github.com/jedib0t/go-pretty/v6/text