From 62ae1ce2ac21b58583da36cf8b84926a4fbda5e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 19:55:41 +0000 Subject: [PATCH] chore(deps): update dependency: bump github.com/jedib0t/go-pretty/v6 Bumps [github.com/jedib0t/go-pretty/v6](https://github.com/jedib0t/go-pretty) from 6.7.8 to 6.7.10. - [Release notes](https://github.com/jedib0t/go-pretty/releases) - [Commits](https://github.com/jedib0t/go-pretty/compare/v6.7.8...v6.7.10) --- updated-dependencies: - dependency-name: github.com/jedib0t/go-pretty/v6 dependency-version: 6.7.10 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 | 25 ++++++++-- vendor/modules.txt | 2 +- 7 files changed, 97 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 9b237f1..37ade64 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-chi/chi/v5 v5.3.0 github.com/google/uuid v1.6.0 github.com/hashicorp/nomad/api v0.0.0-20260220212019-daca79db0bd6 - github.com/jedib0t/go-pretty/v6 v6.7.8 + github.com/jedib0t/go-pretty/v6 v6.7.10 github.com/rs/zerolog v1.35.1 github.com/stretchr/testify v1.11.1 ) diff --git a/go.sum b/go.sum index 1fc6ded..d1d6b02 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,8 @@ github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5O github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/nomad/api v0.0.0-20260220212019-daca79db0bd6 h1:QN/GwpGyiW8RdNcHGMA1xVnM8tJkAGNDR/BZ47XR+OU= github.com/hashicorp/nomad/api v0.0.0-20260220212019-daca79db0bd6/go.mod h1:KkLNLU0Nyfh5jWsFoF/PsmMbKpRIAoIV4lmQoJWgKCk= -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.10 h1:B/2qW2Bkv2L6n14PP8o1kx75kWzHOQ3YTluWzg9icac= +github.com/jedib0t/go-pretty/v6 v6.7.10/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/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 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 ff298b1..d7227d3 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 b5f5849..0b2473d 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 0000000..a4c6632 --- /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 189531d..18cc59e 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 + " " } } @@ -119,6 +127,13 @@ func justifyText(text string, textLength int, maxLength int) string { // get the number of spaces to insert into the text numSpacesNeeded := maxLength - textLength + strings.Count(text, " ") + if numSpacesNeeded < 0 { + // textLength (display-width) exceeds maxLength; this can happen + // when the cell contains wide Unicode characters (e.g. CJK) whose + // display width is greater than their rune count. Return the text + // as-is; truncation is the caller's responsibility. + return text + } numSpacesNeededBetweenWords := 0 if len(words) > 1 { numSpacesNeededBetweenWords = numSpacesNeeded / (len(words) - 1) diff --git a/vendor/modules.txt b/vendor/modules.txt index b29820d..40d4225 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -57,7 +57,7 @@ github.com/hashicorp/go-rootcerts ## explicit; go 1.20 github.com/hashicorp/nomad/api github.com/hashicorp/nomad/api/contexts -# github.com/jedib0t/go-pretty/v6 v6.7.8 +# github.com/jedib0t/go-pretty/v6 v6.7.10 ## explicit; go 1.18 github.com/jedib0t/go-pretty/v6/table github.com/jedib0t/go-pretty/v6/text