mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Go: Bump github.com/jedib0t/go-pretty/v6 from 6.4.3 to 6.4.7 (#7067)
Bumps [github.com/jedib0t/go-pretty/v6](https://github.com/jedib0t/go-pretty) from 6.4.3 to 6.4.7. - [Release notes](https://github.com/jedib0t/go-pretty/releases) - [Commits](https://github.com/jedib0t/go-pretty/compare/v6.4.3...v6.4.7) --- updated-dependencies: - dependency-name: github.com/jedib0t/go-pretty/v6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
2
go.mod
2
go.mod
@@ -25,7 +25,7 @@ require (
|
|||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/google/go-cmp v0.5.9
|
github.com/google/go-cmp v0.5.9
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/jedib0t/go-pretty/v6 v6.4.3
|
github.com/jedib0t/go-pretty/v6 v6.4.7
|
||||||
github.com/kubernetes-sigs/service-catalog v0.3.1
|
github.com/kubernetes-sigs/service-catalog v0.3.1
|
||||||
github.com/mattn/go-colorable v0.1.13
|
github.com/mattn/go-colorable v0.1.13
|
||||||
github.com/olekukonko/tablewriter v0.0.5
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
|
|||||||
4
go.sum
generated
4
go.sum
generated
@@ -765,8 +765,8 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf
|
|||||||
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
|
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||||
github.com/jedib0t/go-pretty/v6 v6.4.3 h1:2n9BZ0YQiXGESUSR+6FLg0WWWE80u+mIz35f0uHWcIE=
|
github.com/jedib0t/go-pretty/v6 v6.4.7 h1:lwiTJr1DEkAgzljsUsORmWsVn5MQjt1BPJdPCtJ6KXE=
|
||||||
github.com/jedib0t/go-pretty/v6 v6.4.3/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
|
github.com/jedib0t/go-pretty/v6 v6.4.7/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
|
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
|
||||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||||
|
|||||||
15
vendor/github.com/jedib0t/go-pretty/v6/table/render.go
generated
vendored
15
vendor/github.com/jedib0t/go-pretty/v6/table/render.go
generated
vendored
@@ -365,15 +365,16 @@ func (t *Table) renderRowsHeader(out *strings.Builder) {
|
|||||||
func (t *Table) renderTitle(out *strings.Builder) {
|
func (t *Table) renderTitle(out *strings.Builder) {
|
||||||
if t.title != "" {
|
if t.title != "" {
|
||||||
colors := t.style.Title.Colors
|
colors := t.style.Title.Colors
|
||||||
|
colorsBorder := t.getBorderColors(renderHint{isTitleRow: true})
|
||||||
rowLength := t.maxRowLength
|
rowLength := t.maxRowLength
|
||||||
if t.allowedRowLength != 0 && t.allowedRowLength < rowLength {
|
if t.allowedRowLength != 0 && t.allowedRowLength < rowLength {
|
||||||
rowLength = t.allowedRowLength
|
rowLength = t.allowedRowLength
|
||||||
}
|
}
|
||||||
if t.style.Options.DrawBorder {
|
if t.style.Options.DrawBorder {
|
||||||
lenBorder := rowLength - text.RuneWidthWithoutEscSequences(t.style.Box.TopLeft+t.style.Box.TopRight)
|
lenBorder := rowLength - text.RuneWidthWithoutEscSequences(t.style.Box.TopLeft+t.style.Box.TopRight)
|
||||||
out.WriteString(colors.Sprint(t.style.Box.TopLeft))
|
out.WriteString(colorsBorder.Sprint(t.style.Box.TopLeft))
|
||||||
out.WriteString(colors.Sprint(text.RepeatAndTrim(t.style.Box.MiddleHorizontal, lenBorder)))
|
out.WriteString(colorsBorder.Sprint(text.RepeatAndTrim(t.style.Box.MiddleHorizontal, lenBorder)))
|
||||||
out.WriteString(colors.Sprint(t.style.Box.TopRight))
|
out.WriteString(colorsBorder.Sprint(t.style.Box.TopRight))
|
||||||
}
|
}
|
||||||
|
|
||||||
lenText := rowLength - text.RuneWidthWithoutEscSequences(t.style.Box.PaddingLeft+t.style.Box.PaddingRight)
|
lenText := rowLength - text.RuneWidthWithoutEscSequences(t.style.Box.PaddingLeft+t.style.Box.PaddingRight)
|
||||||
@@ -382,12 +383,12 @@ func (t *Table) renderTitle(out *strings.Builder) {
|
|||||||
}
|
}
|
||||||
titleText := text.WrapText(t.title, lenText)
|
titleText := text.WrapText(t.title, lenText)
|
||||||
for _, titleLine := range strings.Split(titleText, "\n") {
|
for _, titleLine := range strings.Split(titleText, "\n") {
|
||||||
t.renderTitleLine(out, lenText, titleLine, colors)
|
t.renderTitleLine(out, lenText, titleLine, colors, colorsBorder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) renderTitleLine(out *strings.Builder, lenText int, titleLine string, colors text.Colors) {
|
func (t *Table) renderTitleLine(out *strings.Builder, lenText int, titleLine string, colors text.Colors, colorsBorder text.Colors) {
|
||||||
titleLine = strings.TrimSpace(titleLine)
|
titleLine = strings.TrimSpace(titleLine)
|
||||||
titleLine = t.style.Title.Format.Apply(titleLine)
|
titleLine = t.style.Title.Format.Apply(titleLine)
|
||||||
titleLine = t.style.Title.Align.Apply(titleLine, lenText)
|
titleLine = t.style.Title.Align.Apply(titleLine, lenText)
|
||||||
@@ -397,10 +398,10 @@ func (t *Table) renderTitleLine(out *strings.Builder, lenText int, titleLine str
|
|||||||
out.WriteRune('\n')
|
out.WriteRune('\n')
|
||||||
}
|
}
|
||||||
if t.style.Options.DrawBorder {
|
if t.style.Options.DrawBorder {
|
||||||
out.WriteString(colors.Sprint(t.style.Box.Left))
|
out.WriteString(colorsBorder.Sprint(t.style.Box.Left))
|
||||||
}
|
}
|
||||||
out.WriteString(colors.Sprint(titleLine))
|
out.WriteString(colors.Sprint(titleLine))
|
||||||
if t.style.Options.DrawBorder {
|
if t.style.Options.DrawBorder {
|
||||||
out.WriteString(colors.Sprint(t.style.Box.Right))
|
out.WriteString(colorsBorder.Sprint(t.style.Box.Right))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
vendor/github.com/jedib0t/go-pretty/v6/table/render_hint.go
generated
vendored
5
vendor/github.com/jedib0t/go-pretty/v6/table/render_hint.go
generated
vendored
@@ -12,10 +12,15 @@ type renderHint struct {
|
|||||||
isLastLineOfRow bool // last-line of the current row?
|
isLastLineOfRow bool // last-line of the current row?
|
||||||
isLastRow bool // last-row of header/footer/regular-rows?
|
isLastRow bool // last-row of header/footer/regular-rows?
|
||||||
isSeparatorRow bool // separator row?
|
isSeparatorRow bool // separator row?
|
||||||
|
isTitleRow bool // title row?
|
||||||
rowLineNumber int // the line number for a multi-line row
|
rowLineNumber int // the line number for a multi-line row
|
||||||
rowNumber int // the row number/index
|
rowNumber int // the row number/index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *renderHint) isBorderOrSeparator() bool {
|
||||||
|
return h.isBorderTop || h.isSeparatorRow || h.isBorderBottom
|
||||||
|
}
|
||||||
|
|
||||||
func (h *renderHint) isRegularRow() bool {
|
func (h *renderHint) isRegularRow() bool {
|
||||||
return !h.isHeaderRow && !h.isFooterRow
|
return !h.isHeaderRow && !h.isFooterRow
|
||||||
}
|
}
|
||||||
|
|||||||
4
vendor/github.com/jedib0t/go-pretty/v6/table/render_html.go
generated
vendored
4
vendor/github.com/jedib0t/go-pretty/v6/table/render_html.go
generated
vendored
@@ -112,7 +112,7 @@ func (t *Table) htmlRenderColumn(out *strings.Builder, colStr string) {
|
|||||||
out.WriteString(colStr)
|
out.WriteString(colStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) htmlRenderColumnAttributes(out *strings.Builder, row rowStr, colIdx int, hint renderHint) {
|
func (t *Table) htmlRenderColumnAttributes(out *strings.Builder, colIdx int, hint renderHint) {
|
||||||
// determine the HTML "align"/"valign" property values
|
// determine the HTML "align"/"valign" property values
|
||||||
align := t.getAlign(colIdx, hint).HTMLProperty()
|
align := t.getAlign(colIdx, hint).HTMLProperty()
|
||||||
vAlign := t.getVAlign(colIdx, hint).HTMLProperty()
|
vAlign := t.getVAlign(colIdx, hint).HTMLProperty()
|
||||||
@@ -161,7 +161,7 @@ func (t *Table) htmlRenderRow(out *strings.Builder, row rowStr, hint renderHint)
|
|||||||
// write the row
|
// write the row
|
||||||
out.WriteString(" <")
|
out.WriteString(" <")
|
||||||
out.WriteString(colTagName)
|
out.WriteString(colTagName)
|
||||||
t.htmlRenderColumnAttributes(out, row, colIdx, hint)
|
t.htmlRenderColumnAttributes(out, colIdx, hint)
|
||||||
out.WriteString(">")
|
out.WriteString(">")
|
||||||
if len(colStr) == 0 {
|
if len(colStr) == 0 {
|
||||||
out.WriteString(t.style.HTML.EmptyColumn)
|
out.WriteString(t.style.HTML.EmptyColumn)
|
||||||
|
|||||||
8
vendor/github.com/jedib0t/go-pretty/v6/table/render_init.go
generated
vendored
8
vendor/github.com/jedib0t/go-pretty/v6/table/render_init.go
generated
vendored
@@ -43,12 +43,8 @@ func (t *Table) analyzeAndStringifyColumn(colIdx int, col interface{}, hint rend
|
|||||||
} else {
|
} else {
|
||||||
colStr = fmt.Sprint(col)
|
colStr = fmt.Sprint(col)
|
||||||
}
|
}
|
||||||
if strings.Contains(colStr, "\t") {
|
colStr = strings.ReplaceAll(colStr, "\t", " ")
|
||||||
colStr = strings.Replace(colStr, "\t", " ", -1)
|
colStr = strings.ReplaceAll(colStr, "\r", "")
|
||||||
}
|
|
||||||
if strings.Contains(colStr, "\r") {
|
|
||||||
colStr = strings.Replace(colStr, "\r", "", -1)
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%s%s", t.style.Format.Direction.Modifier(), colStr)
|
return fmt.Sprintf("%s%s", t.style.Format.Direction.Modifier(), colStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
vendor/github.com/jedib0t/go-pretty/v6/table/render_markdown.go
generated
vendored
9
vendor/github.com/jedib0t/go-pretty/v6/table/render_markdown.go
generated
vendored
@@ -54,12 +54,8 @@ func (t *Table) markdownRenderRow(out *strings.Builder, row rowStr, hint renderH
|
|||||||
colStr = row[colIdx]
|
colStr = row[colIdx]
|
||||||
}
|
}
|
||||||
out.WriteRune(' ')
|
out.WriteRune(' ')
|
||||||
if strings.Contains(colStr, "|") {
|
colStr = strings.ReplaceAll(colStr, "|", "\\|")
|
||||||
colStr = strings.Replace(colStr, "|", "\\|", -1)
|
colStr = strings.ReplaceAll(colStr, "\n", "<br/>")
|
||||||
}
|
|
||||||
if strings.Contains(colStr, "\n") {
|
|
||||||
colStr = strings.Replace(colStr, "\n", "<br/>", -1)
|
|
||||||
}
|
|
||||||
out.WriteString(colStr)
|
out.WriteString(colStr)
|
||||||
out.WriteRune(' ')
|
out.WriteRune(' ')
|
||||||
}
|
}
|
||||||
@@ -94,7 +90,6 @@ func (t *Table) markdownRenderRows(out *strings.Builder, rows []rowStr, hint ren
|
|||||||
|
|
||||||
func (t *Table) markdownRenderRowsFooter(out *strings.Builder) {
|
func (t *Table) markdownRenderRowsFooter(out *strings.Builder) {
|
||||||
t.markdownRenderRows(out, t.rowsFooter, renderHint{isFooterRow: true})
|
t.markdownRenderRows(out, t.rowsFooter, renderHint{isFooterRow: true})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) markdownRenderRowsHeader(out *strings.Builder) {
|
func (t *Table) markdownRenderRowsHeader(out *strings.Builder) {
|
||||||
|
|||||||
62
vendor/github.com/jedib0t/go-pretty/v6/table/style.go
generated
vendored
62
vendor/github.com/jedib0t/go-pretty/v6/table/style.go
generated
vendored
@@ -533,11 +533,13 @@ var (
|
|||||||
|
|
||||||
// ColorOptions defines the ANSI colors to use for parts of the Table.
|
// ColorOptions defines the ANSI colors to use for parts of the Table.
|
||||||
type ColorOptions struct {
|
type ColorOptions struct {
|
||||||
IndexColumn text.Colors // index-column colors (row #, etc.)
|
Border text.Colors // borders (if nil, uses one of the below)
|
||||||
Footer text.Colors // footer row(s) colors
|
Footer text.Colors // footer row(s) colors
|
||||||
Header text.Colors // header row(s) colors
|
Header text.Colors // header row(s) colors
|
||||||
|
IndexColumn text.Colors // index-column colors (row #, etc.)
|
||||||
Row text.Colors // regular row(s) colors
|
Row text.Colors // regular row(s) colors
|
||||||
RowAlternate text.Colors // regular row(s) colors for the even-numbered rows
|
RowAlternate text.Colors // regular row(s) colors for the even-numbered rows
|
||||||
|
Separator text.Colors // separators (if nil, uses one of the above)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -552,18 +554,18 @@ var (
|
|||||||
|
|
||||||
// ColorOptionsBlackOnBlueWhite renders Black text on Blue/White background.
|
// ColorOptionsBlackOnBlueWhite renders Black text on Blue/White background.
|
||||||
ColorOptionsBlackOnBlueWhite = ColorOptions{
|
ColorOptionsBlackOnBlueWhite = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.BgHiBlue, text.FgBlack},
|
|
||||||
Footer: text.Colors{text.BgBlue, text.FgBlack},
|
Footer: text.Colors{text.BgBlue, text.FgBlack},
|
||||||
Header: text.Colors{text.BgHiBlue, text.FgBlack},
|
Header: text.Colors{text.BgHiBlue, text.FgBlack},
|
||||||
|
IndexColumn: text.Colors{text.BgHiBlue, text.FgBlack},
|
||||||
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
||||||
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorOptionsBlackOnCyanWhite renders Black text on Cyan/White background.
|
// ColorOptionsBlackOnCyanWhite renders Black text on Cyan/White background.
|
||||||
ColorOptionsBlackOnCyanWhite = ColorOptions{
|
ColorOptionsBlackOnCyanWhite = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.BgHiCyan, text.FgBlack},
|
|
||||||
Footer: text.Colors{text.BgCyan, text.FgBlack},
|
Footer: text.Colors{text.BgCyan, text.FgBlack},
|
||||||
Header: text.Colors{text.BgHiCyan, text.FgBlack},
|
Header: text.Colors{text.BgHiCyan, text.FgBlack},
|
||||||
|
IndexColumn: text.Colors{text.BgHiCyan, text.FgBlack},
|
||||||
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
||||||
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
||||||
}
|
}
|
||||||
@@ -571,9 +573,9 @@ var (
|
|||||||
// ColorOptionsBlackOnGreenWhite renders Black text on Green/White
|
// ColorOptionsBlackOnGreenWhite renders Black text on Green/White
|
||||||
// background.
|
// background.
|
||||||
ColorOptionsBlackOnGreenWhite = ColorOptions{
|
ColorOptionsBlackOnGreenWhite = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.BgHiGreen, text.FgBlack},
|
|
||||||
Footer: text.Colors{text.BgGreen, text.FgBlack},
|
Footer: text.Colors{text.BgGreen, text.FgBlack},
|
||||||
Header: text.Colors{text.BgHiGreen, text.FgBlack},
|
Header: text.Colors{text.BgHiGreen, text.FgBlack},
|
||||||
|
IndexColumn: text.Colors{text.BgHiGreen, text.FgBlack},
|
||||||
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
||||||
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
||||||
}
|
}
|
||||||
@@ -581,18 +583,18 @@ var (
|
|||||||
// ColorOptionsBlackOnMagentaWhite renders Black text on Magenta/White
|
// ColorOptionsBlackOnMagentaWhite renders Black text on Magenta/White
|
||||||
// background.
|
// background.
|
||||||
ColorOptionsBlackOnMagentaWhite = ColorOptions{
|
ColorOptionsBlackOnMagentaWhite = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.BgHiMagenta, text.FgBlack},
|
|
||||||
Footer: text.Colors{text.BgMagenta, text.FgBlack},
|
Footer: text.Colors{text.BgMagenta, text.FgBlack},
|
||||||
Header: text.Colors{text.BgHiMagenta, text.FgBlack},
|
Header: text.Colors{text.BgHiMagenta, text.FgBlack},
|
||||||
|
IndexColumn: text.Colors{text.BgHiMagenta, text.FgBlack},
|
||||||
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
||||||
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorOptionsBlackOnRedWhite renders Black text on Red/White background.
|
// ColorOptionsBlackOnRedWhite renders Black text on Red/White background.
|
||||||
ColorOptionsBlackOnRedWhite = ColorOptions{
|
ColorOptionsBlackOnRedWhite = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.BgHiRed, text.FgBlack},
|
|
||||||
Footer: text.Colors{text.BgRed, text.FgBlack},
|
Footer: text.Colors{text.BgRed, text.FgBlack},
|
||||||
Header: text.Colors{text.BgHiRed, text.FgBlack},
|
Header: text.Colors{text.BgHiRed, text.FgBlack},
|
||||||
|
IndexColumn: text.Colors{text.BgHiRed, text.FgBlack},
|
||||||
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
||||||
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
||||||
}
|
}
|
||||||
@@ -600,27 +602,27 @@ var (
|
|||||||
// ColorOptionsBlackOnYellowWhite renders Black text on Yellow/White
|
// ColorOptionsBlackOnYellowWhite renders Black text on Yellow/White
|
||||||
// background.
|
// background.
|
||||||
ColorOptionsBlackOnYellowWhite = ColorOptions{
|
ColorOptionsBlackOnYellowWhite = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.BgHiYellow, text.FgBlack},
|
|
||||||
Footer: text.Colors{text.BgYellow, text.FgBlack},
|
Footer: text.Colors{text.BgYellow, text.FgBlack},
|
||||||
Header: text.Colors{text.BgHiYellow, text.FgBlack},
|
Header: text.Colors{text.BgHiYellow, text.FgBlack},
|
||||||
|
IndexColumn: text.Colors{text.BgHiYellow, text.FgBlack},
|
||||||
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
Row: text.Colors{text.BgHiWhite, text.FgBlack},
|
||||||
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
RowAlternate: text.Colors{text.BgWhite, text.FgBlack},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorOptionsBlueWhiteOnBlack renders Blue/White text on Black background.
|
// ColorOptionsBlueWhiteOnBlack renders Blue/White text on Black background.
|
||||||
ColorOptionsBlueWhiteOnBlack = ColorOptions{
|
ColorOptionsBlueWhiteOnBlack = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.FgHiBlue, text.BgHiBlack},
|
|
||||||
Footer: text.Colors{text.FgBlue, text.BgHiBlack},
|
Footer: text.Colors{text.FgBlue, text.BgHiBlack},
|
||||||
Header: text.Colors{text.FgHiBlue, text.BgHiBlack},
|
Header: text.Colors{text.FgHiBlue, text.BgHiBlack},
|
||||||
|
IndexColumn: text.Colors{text.FgHiBlue, text.BgHiBlack},
|
||||||
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
||||||
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorOptionsCyanWhiteOnBlack renders Cyan/White text on Black background.
|
// ColorOptionsCyanWhiteOnBlack renders Cyan/White text on Black background.
|
||||||
ColorOptionsCyanWhiteOnBlack = ColorOptions{
|
ColorOptionsCyanWhiteOnBlack = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.FgHiCyan, text.BgHiBlack},
|
|
||||||
Footer: text.Colors{text.FgCyan, text.BgHiBlack},
|
Footer: text.Colors{text.FgCyan, text.BgHiBlack},
|
||||||
Header: text.Colors{text.FgHiCyan, text.BgHiBlack},
|
Header: text.Colors{text.FgHiCyan, text.BgHiBlack},
|
||||||
|
IndexColumn: text.Colors{text.FgHiCyan, text.BgHiBlack},
|
||||||
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
||||||
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
||||||
}
|
}
|
||||||
@@ -628,9 +630,9 @@ var (
|
|||||||
// ColorOptionsGreenWhiteOnBlack renders Green/White text on Black
|
// ColorOptionsGreenWhiteOnBlack renders Green/White text on Black
|
||||||
// background.
|
// background.
|
||||||
ColorOptionsGreenWhiteOnBlack = ColorOptions{
|
ColorOptionsGreenWhiteOnBlack = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.FgHiGreen, text.BgHiBlack},
|
|
||||||
Footer: text.Colors{text.FgGreen, text.BgHiBlack},
|
Footer: text.Colors{text.FgGreen, text.BgHiBlack},
|
||||||
Header: text.Colors{text.FgHiGreen, text.BgHiBlack},
|
Header: text.Colors{text.FgHiGreen, text.BgHiBlack},
|
||||||
|
IndexColumn: text.Colors{text.FgHiGreen, text.BgHiBlack},
|
||||||
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
||||||
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
||||||
}
|
}
|
||||||
@@ -638,18 +640,18 @@ var (
|
|||||||
// ColorOptionsMagentaWhiteOnBlack renders Magenta/White text on Black
|
// ColorOptionsMagentaWhiteOnBlack renders Magenta/White text on Black
|
||||||
// background.
|
// background.
|
||||||
ColorOptionsMagentaWhiteOnBlack = ColorOptions{
|
ColorOptionsMagentaWhiteOnBlack = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.FgHiMagenta, text.BgHiBlack},
|
|
||||||
Footer: text.Colors{text.FgMagenta, text.BgHiBlack},
|
Footer: text.Colors{text.FgMagenta, text.BgHiBlack},
|
||||||
Header: text.Colors{text.FgHiMagenta, text.BgHiBlack},
|
Header: text.Colors{text.FgHiMagenta, text.BgHiBlack},
|
||||||
|
IndexColumn: text.Colors{text.FgHiMagenta, text.BgHiBlack},
|
||||||
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
||||||
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorOptionsRedWhiteOnBlack renders Red/White text on Black background.
|
// ColorOptionsRedWhiteOnBlack renders Red/White text on Black background.
|
||||||
ColorOptionsRedWhiteOnBlack = ColorOptions{
|
ColorOptionsRedWhiteOnBlack = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.FgHiRed, text.BgHiBlack},
|
|
||||||
Footer: text.Colors{text.FgRed, text.BgHiBlack},
|
Footer: text.Colors{text.FgRed, text.BgHiBlack},
|
||||||
Header: text.Colors{text.FgHiRed, text.BgHiBlack},
|
Header: text.Colors{text.FgHiRed, text.BgHiBlack},
|
||||||
|
IndexColumn: text.Colors{text.FgHiRed, text.BgHiBlack},
|
||||||
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
||||||
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
||||||
}
|
}
|
||||||
@@ -657,9 +659,9 @@ var (
|
|||||||
// ColorOptionsYellowWhiteOnBlack renders Yellow/White text on Black
|
// ColorOptionsYellowWhiteOnBlack renders Yellow/White text on Black
|
||||||
// background.
|
// background.
|
||||||
ColorOptionsYellowWhiteOnBlack = ColorOptions{
|
ColorOptionsYellowWhiteOnBlack = ColorOptions{
|
||||||
IndexColumn: text.Colors{text.FgHiYellow, text.BgHiBlack},
|
|
||||||
Footer: text.Colors{text.FgYellow, text.BgHiBlack},
|
Footer: text.Colors{text.FgYellow, text.BgHiBlack},
|
||||||
Header: text.Colors{text.FgHiYellow, text.BgHiBlack},
|
Header: text.Colors{text.FgHiYellow, text.BgHiBlack},
|
||||||
|
IndexColumn: text.Colors{text.FgHiYellow, text.BgHiBlack},
|
||||||
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
Row: text.Colors{text.FgHiWhite, text.BgBlack},
|
||||||
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
RowAlternate: text.Colors{text.FgWhite, text.BgBlack},
|
||||||
}
|
}
|
||||||
@@ -673,14 +675,12 @@ type FormatOptions struct {
|
|||||||
Row text.Format // (data) row(s) text format
|
Row text.Format // (data) row(s) text format
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
// FormatOptionsDefault defines sensible formatting options.
|
||||||
// FormatOptionsDefault defines sensible formatting options.
|
var FormatOptionsDefault = FormatOptions{
|
||||||
FormatOptionsDefault = FormatOptions{
|
Footer: text.FormatUpper,
|
||||||
Footer: text.FormatUpper,
|
Header: text.FormatUpper,
|
||||||
Header: text.FormatUpper,
|
Row: text.FormatDefault,
|
||||||
Row: text.FormatDefault,
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// HTMLOptions defines the global options to control HTML rendering.
|
// HTMLOptions defines the global options to control HTML rendering.
|
||||||
type HTMLOptions struct {
|
type HTMLOptions struct {
|
||||||
@@ -690,19 +690,21 @@ type HTMLOptions struct {
|
|||||||
Newline string // string to replace "\n" characters with
|
Newline string // string to replace "\n" characters with
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
// DefaultHTMLOptions defines sensible HTML rendering defaults.
|
||||||
// DefaultHTMLOptions defines sensible HTML rendering defaults.
|
var DefaultHTMLOptions = HTMLOptions{
|
||||||
DefaultHTMLOptions = HTMLOptions{
|
CSSClass: DefaultHTMLCSSClass,
|
||||||
CSSClass: DefaultHTMLCSSClass,
|
EmptyColumn: " ",
|
||||||
EmptyColumn: " ",
|
EscapeText: true,
|
||||||
EscapeText: true,
|
Newline: "<br/>",
|
||||||
Newline: "<br/>",
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// Options defines the global options that determine how the Table is
|
// Options defines the global options that determine how the Table is
|
||||||
// rendered.
|
// rendered.
|
||||||
type Options struct {
|
type Options struct {
|
||||||
|
// DoNotColorBordersAndSeparators disables coloring all the borders and row
|
||||||
|
// or column separators.
|
||||||
|
DoNotColorBordersAndSeparators bool
|
||||||
|
|
||||||
// DrawBorder enables or disables drawing the border around the Table.
|
// DrawBorder enables or disables drawing the border around the Table.
|
||||||
// Example of a table where it is disabled:
|
// Example of a table where it is disabled:
|
||||||
// # │ FIRST NAME │ LAST NAME │ SALARY │
|
// # │ FIRST NAME │ LAST NAME │ SALARY │
|
||||||
|
|||||||
47
vendor/github.com/jedib0t/go-pretty/v6/table/table.go
generated
vendored
47
vendor/github.com/jedib0t/go-pretty/v6/table/table.go
generated
vendored
@@ -32,13 +32,13 @@ func (row rowStr) areEqual(colIdx1 int, colIdx2 int) bool {
|
|||||||
return colIdx1 >= 0 && colIdx2 < len(row) && row[colIdx1] == row[colIdx2]
|
return colIdx1 >= 0 && colIdx2 < len(row) && row[colIdx1] == row[colIdx2]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table helps print a 2-dimensional array in a human readable pretty-table.
|
// Table helps print a 2-dimensional array in a human-readable pretty-table.
|
||||||
type Table struct {
|
type Table struct {
|
||||||
// allowedRowLength is the max allowed length for a row (or line of output)
|
// allowedRowLength is the max allowed length for a row (or line of output)
|
||||||
allowedRowLength int
|
allowedRowLength int
|
||||||
// enable automatic indexing of the rows and columns like a spreadsheet?
|
// enable automatic indexing of the rows and columns like a spreadsheet?
|
||||||
autoIndex bool
|
autoIndex bool
|
||||||
// autoIndexVIndexMaxLength denotes the length in chars for the last rownum
|
// autoIndexVIndexMaxLength denotes the length in chars for the last row
|
||||||
autoIndexVIndexMaxLength int
|
autoIndexVIndexMaxLength int
|
||||||
// caption stores the text to be rendered just below the table; and doesn't
|
// caption stores the text to be rendered just below the table; and doesn't
|
||||||
// get used when rendered as a CSV
|
// get used when rendered as a CSV
|
||||||
@@ -228,7 +228,7 @@ func (t *Table) SetColumnConfigs(configs []ColumnConfig) {
|
|||||||
t.columnConfigs = configs
|
t.columnConfigs = configs
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHTMLCSSClass sets the the HTML CSS Class to use on the <table> node
|
// SetHTMLCSSClass sets the HTML CSS Class to use on the <table> node
|
||||||
// when rendering the Table in HTML format.
|
// when rendering the Table in HTML format.
|
||||||
//
|
//
|
||||||
// Deprecated: in favor of Style().HTML.CSSClass
|
// Deprecated: in favor of Style().HTML.CSSClass
|
||||||
@@ -326,7 +326,13 @@ func (t *Table) getAutoIndexColumnIDs() rowStr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) getBorderColors(hint renderHint) text.Colors {
|
func (t *Table) getBorderColors(hint renderHint) text.Colors {
|
||||||
if hint.isHeaderRow {
|
if t.style.Options.DoNotColorBordersAndSeparators {
|
||||||
|
return nil
|
||||||
|
} else if t.style.Color.Border != nil {
|
||||||
|
return t.style.Color.Border
|
||||||
|
} else if hint.isTitleRow {
|
||||||
|
return t.style.Title.Colors
|
||||||
|
} else if hint.isHeaderRow {
|
||||||
return t.style.Color.Header
|
return t.style.Color.Header
|
||||||
} else if hint.isFooterRow {
|
} else if hint.isFooterRow {
|
||||||
return t.style.Color.Footer
|
return t.style.Color.Footer
|
||||||
@@ -381,9 +387,13 @@ func (t *Table) getBorderRight(hint renderHint) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) getColumnColors(colIdx int, hint renderHint) text.Colors {
|
func (t *Table) getColumnColors(colIdx int, hint renderHint) text.Colors {
|
||||||
|
if hint.isBorderOrSeparator() {
|
||||||
|
if colors := t.getColumnColorsForBorderOrSeparator(hint); colors != nil {
|
||||||
|
return colors
|
||||||
|
}
|
||||||
|
}
|
||||||
if t.rowPainter != nil && hint.isRegularNonSeparatorRow() && !t.isIndexColumn(colIdx, hint) {
|
if t.rowPainter != nil && hint.isRegularNonSeparatorRow() && !t.isIndexColumn(colIdx, hint) {
|
||||||
colors := t.rowsColors[hint.rowNumber-1]
|
if colors := t.rowsColors[hint.rowNumber-1]; colors != nil {
|
||||||
if colors != nil {
|
|
||||||
return colors
|
return colors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,6 +410,19 @@ func (t *Table) getColumnColors(colIdx int, hint renderHint) text.Colors {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Table) getColumnColorsForBorderOrSeparator(hint renderHint) text.Colors {
|
||||||
|
if t.style.Options.DoNotColorBordersAndSeparators {
|
||||||
|
return text.Colors{} // not nil to force caller to paint with no colors
|
||||||
|
}
|
||||||
|
if (hint.isBorderBottom || hint.isBorderTop) && t.style.Color.Border != nil {
|
||||||
|
return t.style.Color.Border
|
||||||
|
}
|
||||||
|
if hint.isSeparatorRow && t.style.Color.Separator != nil {
|
||||||
|
return t.style.Color.Separator
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Table) getColumnSeparator(row rowStr, colIdx int, hint renderHint) string {
|
func (t *Table) getColumnSeparator(row rowStr, colIdx int, hint renderHint) string {
|
||||||
separator := t.style.Box.MiddleVertical
|
separator := t.style.Box.MiddleVertical
|
||||||
if hint.isSeparatorRow {
|
if hint.isSeparatorRow {
|
||||||
@@ -578,7 +601,13 @@ func (t *Table) getRowConfig(hint renderHint) RowConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) getSeparatorColors(hint renderHint) text.Colors {
|
func (t *Table) getSeparatorColors(hint renderHint) text.Colors {
|
||||||
if hint.isHeaderRow {
|
if t.style.Options.DoNotColorBordersAndSeparators {
|
||||||
|
return nil
|
||||||
|
} else if (hint.isBorderBottom || hint.isBorderTop) && t.style.Color.Border != nil {
|
||||||
|
return t.style.Color.Border
|
||||||
|
} else if t.style.Color.Separator != nil {
|
||||||
|
return t.style.Color.Separator
|
||||||
|
} else if hint.isHeaderRow {
|
||||||
return t.style.Color.Header
|
return t.style.Color.Header
|
||||||
} else if hint.isFooterRow {
|
} else if hint.isFooterRow {
|
||||||
return t.style.Color.Footer
|
return t.style.Color.Footer
|
||||||
@@ -722,13 +751,13 @@ func (t *Table) shouldMergeCellsVertically(colIdx int, hint renderHint) bool {
|
|||||||
rowPrev := t.getRow(hint.rowNumber-1, hint)
|
rowPrev := t.getRow(hint.rowNumber-1, hint)
|
||||||
rowNext := t.getRow(hint.rowNumber, hint)
|
rowNext := t.getRow(hint.rowNumber, hint)
|
||||||
if colIdx < len(rowPrev) && colIdx < len(rowNext) {
|
if colIdx < len(rowPrev) && colIdx < len(rowNext) {
|
||||||
return rowPrev[colIdx] == rowNext[colIdx] || "" == rowNext[colIdx]
|
return rowPrev[colIdx] == rowNext[colIdx] || rowNext[colIdx] == ""
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rowPrev := t.getRow(hint.rowNumber-2, hint)
|
rowPrev := t.getRow(hint.rowNumber-2, hint)
|
||||||
rowCurr := t.getRow(hint.rowNumber-1, hint)
|
rowCurr := t.getRow(hint.rowNumber-1, hint)
|
||||||
if colIdx < len(rowPrev) && colIdx < len(rowCurr) {
|
if colIdx < len(rowPrev) && colIdx < len(rowCurr) {
|
||||||
return rowPrev[colIdx] == rowCurr[colIdx] || "" == rowCurr[colIdx]
|
return rowPrev[colIdx] == rowCurr[colIdx] || rowCurr[colIdx] == ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
vendor/github.com/jedib0t/go-pretty/v6/table/util.go
generated
vendored
2
vendor/github.com/jedib0t/go-pretty/v6/table/util.go
generated
vendored
@@ -21,7 +21,7 @@ func AutoIndexColumnID(colIdx int) string {
|
|||||||
type WidthEnforcer func(col string, maxLen int) string
|
type WidthEnforcer func(col string, maxLen int) string
|
||||||
|
|
||||||
// widthEnforcerNone returns the input string as is without any modifications.
|
// widthEnforcerNone returns the input string as is without any modifications.
|
||||||
func widthEnforcerNone(col string, maxLen int) string {
|
func widthEnforcerNone(col string, _ int) string {
|
||||||
return col
|
return col
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
vendor/github.com/jedib0t/go-pretty/v6/table/writer.go
generated
vendored
2
vendor/github.com/jedib0t/go-pretty/v6/table/writer.go
generated
vendored
@@ -4,7 +4,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Writer declares the interfaces that can be used to setup and render a table.
|
// Writer declares the interfaces that can be used to set up and render a table.
|
||||||
type Writer interface {
|
type Writer interface {
|
||||||
AppendFooter(row Row, configs ...RowConfig)
|
AppendFooter(row Row, configs ...RowConfig)
|
||||||
AppendHeader(row Row, configs ...RowConfig)
|
AppendHeader(row Row, configs ...RowConfig)
|
||||||
|
|||||||
2
vendor/github.com/jedib0t/go-pretty/v6/text/align.go
generated
vendored
2
vendor/github.com/jedib0t/go-pretty/v6/text/align.go
generated
vendored
@@ -39,7 +39,7 @@ func (a Align) Apply(text string, maxLength int) string {
|
|||||||
if sLenWoE < maxLength {
|
if sLenWoE < maxLength {
|
||||||
// left pad with half the number of spaces needed before using %text
|
// left pad with half the number of spaces needed before using %text
|
||||||
return fmt.Sprintf("%"+strconv.Itoa(maxLength+numEscChars)+"s",
|
return fmt.Sprintf("%"+strconv.Itoa(maxLength+numEscChars)+"s",
|
||||||
text+strings.Repeat(" ", int((maxLength-sLenWoE)/2)))
|
text+strings.Repeat(" ", (maxLength-sLenWoE)/2))
|
||||||
}
|
}
|
||||||
case AlignJustify:
|
case AlignJustify:
|
||||||
return a.justifyText(text, sLenWoE, maxLength)
|
return a.justifyText(text, sLenWoE, maxLength)
|
||||||
|
|||||||
4
vendor/github.com/jedib0t/go-pretty/v6/text/ansi_windows.go
generated
vendored
4
vendor/github.com/jedib0t/go-pretty/v6/text/ansi_windows.go
generated
vendored
@@ -10,9 +10,7 @@ import (
|
|||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var enableVTPMutex = sync.Mutex{}
|
||||||
enableVTPMutex = sync.Mutex{}
|
|
||||||
)
|
|
||||||
|
|
||||||
func areANSICodesSupported() bool {
|
func areANSICodesSupported() bool {
|
||||||
enableVTPMutex.Lock()
|
enableVTPMutex.Lock()
|
||||||
|
|||||||
12
vendor/github.com/jedib0t/go-pretty/v6/text/color.go
generated
vendored
12
vendor/github.com/jedib0t/go-pretty/v6/text/color.go
generated
vendored
@@ -8,9 +8,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var colorsEnabled = areANSICodesSupported()
|
||||||
colorsEnabled = areANSICodesSupported()
|
|
||||||
)
|
|
||||||
|
|
||||||
// DisableColors (forcefully) disables color coding globally.
|
// DisableColors (forcefully) disables color coding globally.
|
||||||
func DisableColors() {
|
func DisableColors() {
|
||||||
@@ -23,7 +21,7 @@ func EnableColors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The logic here is inspired from github.com/fatih/color; the following is
|
// The logic here is inspired from github.com/fatih/color; the following is
|
||||||
// the the bare minimum logic required to print Colored to the console.
|
// the bare minimum logic required to print Colored to the console.
|
||||||
// The differences:
|
// The differences:
|
||||||
// * This one caches the escape sequences for cases with multiple colors
|
// * This one caches the escape sequences for cases with multiple colors
|
||||||
// * This one handles cases where the incoming already has colors in the
|
// * This one handles cases where the incoming already has colors in the
|
||||||
@@ -123,10 +121,8 @@ func (c Color) Sprintf(format string, a ...interface{}) string {
|
|||||||
// Example: Colors{FgCyan, BgBlack}
|
// Example: Colors{FgCyan, BgBlack}
|
||||||
type Colors []Color
|
type Colors []Color
|
||||||
|
|
||||||
var (
|
// colorsSeqMap caches the escape sequence for a set of colors
|
||||||
// colorsSeqMap caches the escape sequence for a set of colors
|
var colorsSeqMap = sync.Map{}
|
||||||
colorsSeqMap = sync.Map{}
|
|
||||||
)
|
|
||||||
|
|
||||||
// EscapeSeq returns the ANSI escape sequence for the colors set.
|
// EscapeSeq returns the ANSI escape sequence for the colors set.
|
||||||
func (c Colors) EscapeSeq() string {
|
func (c Colors) EscapeSeq() string {
|
||||||
|
|||||||
90
vendor/github.com/jedib0t/go-pretty/v6/text/color_html.go
generated
vendored
90
vendor/github.com/jedib0t/go-pretty/v6/text/color_html.go
generated
vendored
@@ -1,48 +1,46 @@
|
|||||||
package text
|
package text
|
||||||
|
|
||||||
var (
|
// colorCSSClassMap contains the equivalent CSS-class for all colors
|
||||||
// colorCSSClassMap contains the equivalent CSS-class for all colors
|
var colorCSSClassMap = map[Color]string{
|
||||||
colorCSSClassMap = map[Color]string{
|
Bold: "bold",
|
||||||
Bold: "bold",
|
Faint: "faint",
|
||||||
Faint: "faint",
|
Italic: "italic",
|
||||||
Italic: "italic",
|
Underline: "underline",
|
||||||
Underline: "underline",
|
BlinkSlow: "blink-slow",
|
||||||
BlinkSlow: "blink-slow",
|
BlinkRapid: "blink-rapid",
|
||||||
BlinkRapid: "blink-rapid",
|
ReverseVideo: "reverse-video",
|
||||||
ReverseVideo: "reverse-video",
|
Concealed: "concealed",
|
||||||
Concealed: "concealed",
|
CrossedOut: "crossed-out",
|
||||||
CrossedOut: "crossed-out",
|
FgBlack: "fg-black",
|
||||||
FgBlack: "fg-black",
|
FgRed: "fg-red",
|
||||||
FgRed: "fg-red",
|
FgGreen: "fg-green",
|
||||||
FgGreen: "fg-green",
|
FgYellow: "fg-yellow",
|
||||||
FgYellow: "fg-yellow",
|
FgBlue: "fg-blue",
|
||||||
FgBlue: "fg-blue",
|
FgMagenta: "fg-magenta",
|
||||||
FgMagenta: "fg-magenta",
|
FgCyan: "fg-cyan",
|
||||||
FgCyan: "fg-cyan",
|
FgWhite: "fg-white",
|
||||||
FgWhite: "fg-white",
|
FgHiBlack: "fg-hi-black",
|
||||||
FgHiBlack: "fg-hi-black",
|
FgHiRed: "fg-hi-red",
|
||||||
FgHiRed: "fg-hi-red",
|
FgHiGreen: "fg-hi-green",
|
||||||
FgHiGreen: "fg-hi-green",
|
FgHiYellow: "fg-hi-yellow",
|
||||||
FgHiYellow: "fg-hi-yellow",
|
FgHiBlue: "fg-hi-blue",
|
||||||
FgHiBlue: "fg-hi-blue",
|
FgHiMagenta: "fg-hi-magenta",
|
||||||
FgHiMagenta: "fg-hi-magenta",
|
FgHiCyan: "fg-hi-cyan",
|
||||||
FgHiCyan: "fg-hi-cyan",
|
FgHiWhite: "fg-hi-white",
|
||||||
FgHiWhite: "fg-hi-white",
|
BgBlack: "bg-black",
|
||||||
BgBlack: "bg-black",
|
BgRed: "bg-red",
|
||||||
BgRed: "bg-red",
|
BgGreen: "bg-green",
|
||||||
BgGreen: "bg-green",
|
BgYellow: "bg-yellow",
|
||||||
BgYellow: "bg-yellow",
|
BgBlue: "bg-blue",
|
||||||
BgBlue: "bg-blue",
|
BgMagenta: "bg-magenta",
|
||||||
BgMagenta: "bg-magenta",
|
BgCyan: "bg-cyan",
|
||||||
BgCyan: "bg-cyan",
|
BgWhite: "bg-white",
|
||||||
BgWhite: "bg-white",
|
BgHiBlack: "bg-hi-black",
|
||||||
BgHiBlack: "bg-hi-black",
|
BgHiRed: "bg-hi-red",
|
||||||
BgHiRed: "bg-hi-red",
|
BgHiGreen: "bg-hi-green",
|
||||||
BgHiGreen: "bg-hi-green",
|
BgHiYellow: "bg-hi-yellow",
|
||||||
BgHiYellow: "bg-hi-yellow",
|
BgHiBlue: "bg-hi-blue",
|
||||||
BgHiBlue: "bg-hi-blue",
|
BgHiMagenta: "bg-hi-magenta",
|
||||||
BgHiMagenta: "bg-hi-magenta",
|
BgHiCyan: "bg-hi-cyan",
|
||||||
BgHiCyan: "bg-hi-cyan",
|
BgHiWhite: "bg-hi-white",
|
||||||
BgHiWhite: "bg-hi-white",
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|||||||
50
vendor/github.com/jedib0t/go-pretty/v6/text/escape.go
generated
vendored
Normal file
50
vendor/github.com/jedib0t/go-pretty/v6/text/escape.go
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package text
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const (
|
||||||
|
CSIStartRune = rune(91) // [
|
||||||
|
CSIStopRune = 'm'
|
||||||
|
EscapeReset = EscapeStart + "0" + EscapeStop
|
||||||
|
EscapeStart = "\x1b["
|
||||||
|
EscapeStartRune = rune(27) // \x1b
|
||||||
|
EscapeStop = "m"
|
||||||
|
EscapeStopRune = 'm'
|
||||||
|
OSIStartRune = rune(93) // ]
|
||||||
|
OSIStopRune = '\\'
|
||||||
|
)
|
||||||
|
|
||||||
|
type escKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
escKindUnknown escKind = iota
|
||||||
|
escKindCSI
|
||||||
|
escKindOSI
|
||||||
|
)
|
||||||
|
|
||||||
|
type escSeq struct {
|
||||||
|
isIn bool
|
||||||
|
content strings.Builder
|
||||||
|
kind escKind
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *escSeq) InspectRune(r rune) {
|
||||||
|
if !e.isIn && r == EscapeStartRune {
|
||||||
|
e.isIn = true
|
||||||
|
e.kind = escKindUnknown
|
||||||
|
e.content.Reset()
|
||||||
|
e.content.WriteRune(r)
|
||||||
|
} else if e.isIn {
|
||||||
|
switch {
|
||||||
|
case e.kind == escKindUnknown && r == CSIStartRune:
|
||||||
|
e.kind = escKindCSI
|
||||||
|
case e.kind == escKindUnknown && r == OSIStartRune:
|
||||||
|
e.kind = escKindOSI
|
||||||
|
case e.kind == escKindCSI && r == CSIStopRune || e.kind == escKindOSI && r == OSIStopRune:
|
||||||
|
e.isIn = false
|
||||||
|
e.kind = escKindUnknown
|
||||||
|
}
|
||||||
|
e.content.WriteRune(r)
|
||||||
|
}
|
||||||
|
}
|
||||||
14
vendor/github.com/jedib0t/go-pretty/v6/text/hyperlink.go
generated
vendored
Normal file
14
vendor/github.com/jedib0t/go-pretty/v6/text/hyperlink.go
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package text
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func Hyperlink(url, text string) string {
|
||||||
|
if url == "" {
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
if text == "" {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
// source https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
|
||||||
|
return fmt.Sprintf("\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\", url, text)
|
||||||
|
}
|
||||||
88
vendor/github.com/jedib0t/go-pretty/v6/text/string.go
generated
vendored
88
vendor/github.com/jedib0t/go-pretty/v6/text/string.go
generated
vendored
@@ -7,15 +7,6 @@ import (
|
|||||||
"github.com/mattn/go-runewidth"
|
"github.com/mattn/go-runewidth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Constants
|
|
||||||
const (
|
|
||||||
EscapeReset = EscapeStart + "0" + EscapeStop
|
|
||||||
EscapeStart = "\x1b["
|
|
||||||
EscapeStartRune = rune(27) // \x1b
|
|
||||||
EscapeStop = "m"
|
|
||||||
EscapeStopRune = 'm'
|
|
||||||
)
|
|
||||||
|
|
||||||
// RuneWidth stuff
|
// RuneWidth stuff
|
||||||
var (
|
var (
|
||||||
rwCondition = runewidth.NewCondition()
|
rwCondition = runewidth.NewCondition()
|
||||||
@@ -35,23 +26,21 @@ func InsertEveryN(str string, runeToInsert rune, n int) string {
|
|||||||
sLen := RuneWidthWithoutEscSequences(str)
|
sLen := RuneWidthWithoutEscSequences(str)
|
||||||
var out strings.Builder
|
var out strings.Builder
|
||||||
out.Grow(sLen + (sLen / n))
|
out.Grow(sLen + (sLen / n))
|
||||||
outLen, isEscSeq := 0, false
|
outLen, eSeq := 0, escSeq{}
|
||||||
for idx, c := range str {
|
for idx, c := range str {
|
||||||
if c == EscapeStartRune {
|
if eSeq.isIn {
|
||||||
isEscSeq = true
|
eSeq.InspectRune(c)
|
||||||
|
out.WriteRune(c)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
eSeq.InspectRune(c)
|
||||||
if !isEscSeq && outLen > 0 && (outLen%n) == 0 && idx != sLen {
|
if !eSeq.isIn && outLen > 0 && (outLen%n) == 0 && idx != sLen {
|
||||||
out.WriteRune(runeToInsert)
|
out.WriteRune(runeToInsert)
|
||||||
}
|
}
|
||||||
out.WriteRune(c)
|
out.WriteRune(c)
|
||||||
if !isEscSeq {
|
if !eSeq.isIn {
|
||||||
outLen += RuneWidth(c)
|
outLen += RuneWidth(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isEscSeq && c == EscapeStopRune {
|
|
||||||
isEscSeq = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return out.String()
|
return out.String()
|
||||||
}
|
}
|
||||||
@@ -60,21 +49,19 @@ func InsertEveryN(str string, runeToInsert rune, n int) string {
|
|||||||
// argument string. For ex.:
|
// argument string. For ex.:
|
||||||
// LongestLineLen("Ghost!\nCome back here!\nRight now!") == 15
|
// LongestLineLen("Ghost!\nCome back here!\nRight now!") == 15
|
||||||
func LongestLineLen(str string) int {
|
func LongestLineLen(str string) int {
|
||||||
maxLength, currLength, isEscSeq := 0, 0, false
|
maxLength, currLength, eSeq := 0, 0, escSeq{}
|
||||||
for _, c := range str {
|
for _, c := range str {
|
||||||
if c == EscapeStartRune {
|
if eSeq.isIn {
|
||||||
isEscSeq = true
|
eSeq.InspectRune(c)
|
||||||
} else if isEscSeq && c == EscapeStopRune {
|
|
||||||
isEscSeq = false
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
eSeq.InspectRune(c)
|
||||||
if c == '\n' {
|
if c == '\n' {
|
||||||
if currLength > maxLength {
|
if currLength > maxLength {
|
||||||
maxLength = currLength
|
maxLength = currLength
|
||||||
}
|
}
|
||||||
currLength = 0
|
currLength = 0
|
||||||
} else if !isEscSeq {
|
} else if !eSeq.isIn {
|
||||||
currLength += RuneWidth(c)
|
currLength += RuneWidth(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,15 +151,14 @@ func RuneWidth(r rune) int {
|
|||||||
// RuneWidthWithoutEscSequences("\x1b[33mGhost\x1b[0m") == 5
|
// RuneWidthWithoutEscSequences("\x1b[33mGhost\x1b[0m") == 5
|
||||||
// RuneWidthWithoutEscSequences("\x1b[33mGhost\x1b[0") == 5
|
// RuneWidthWithoutEscSequences("\x1b[33mGhost\x1b[0") == 5
|
||||||
func RuneWidthWithoutEscSequences(str string) int {
|
func RuneWidthWithoutEscSequences(str string) int {
|
||||||
count, isEscSeq := 0, false
|
count, eSeq := 0, escSeq{}
|
||||||
for _, c := range str {
|
for _, c := range str {
|
||||||
if c == EscapeStartRune {
|
if eSeq.isIn {
|
||||||
isEscSeq = true
|
eSeq.InspectRune(c)
|
||||||
} else if isEscSeq {
|
continue
|
||||||
if c == EscapeStopRune {
|
}
|
||||||
isEscSeq = false
|
eSeq.InspectRune(c)
|
||||||
}
|
if !eSeq.isIn {
|
||||||
} else {
|
|
||||||
count += RuneWidth(c)
|
count += RuneWidth(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,27 +197,23 @@ func Trim(str string, maxLen int) string {
|
|||||||
var out strings.Builder
|
var out strings.Builder
|
||||||
out.Grow(maxLen)
|
out.Grow(maxLen)
|
||||||
|
|
||||||
outLen, isEscSeq, lastEscSeq := 0, false, strings.Builder{}
|
outLen, eSeq := 0, escSeq{}
|
||||||
for _, sChr := range str {
|
for _, sChr := range str {
|
||||||
out.WriteRune(sChr)
|
if eSeq.isIn {
|
||||||
if sChr == EscapeStartRune {
|
eSeq.InspectRune(sChr)
|
||||||
isEscSeq = true
|
out.WriteRune(sChr)
|
||||||
lastEscSeq.Reset()
|
continue
|
||||||
lastEscSeq.WriteRune(sChr)
|
}
|
||||||
} else if isEscSeq {
|
eSeq.InspectRune(sChr)
|
||||||
lastEscSeq.WriteRune(sChr)
|
if eSeq.isIn {
|
||||||
if sChr == EscapeStopRune {
|
out.WriteRune(sChr)
|
||||||
isEscSeq = false
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
if outLen < maxLen {
|
||||||
outLen++
|
outLen++
|
||||||
if outLen == maxLen {
|
out.WriteRune(sChr)
|
||||||
break
|
continue
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if lastEscSeq.Len() > 0 && lastEscSeq.String() != EscapeReset {
|
|
||||||
out.WriteString(EscapeReset)
|
|
||||||
}
|
}
|
||||||
return out.String()
|
return out.String()
|
||||||
}
|
}
|
||||||
|
|||||||
8
vendor/github.com/jedib0t/go-pretty/v6/text/transformer.go
generated
vendored
8
vendor/github.com/jedib0t/go-pretty/v6/text/transformer.go
generated
vendored
@@ -79,7 +79,7 @@ func transformInt(format string, val interface{}) string {
|
|||||||
return transform(int64(number))
|
return transform(int64(number))
|
||||||
}
|
}
|
||||||
if number, ok := val.(int64); ok {
|
if number, ok := val.(int64); ok {
|
||||||
return transform(int64(number))
|
return transform(number)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ func transformUint(format string, val interface{}) string {
|
|||||||
return transform(uint64(number))
|
return transform(uint64(number))
|
||||||
}
|
}
|
||||||
if number, ok := val.(uint64); ok {
|
if number, ok := val.(uint64); ok {
|
||||||
return transform(uint64(number))
|
return transform(number)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ func transformFloat(format string, val interface{}) string {
|
|||||||
return transform(float64(number))
|
return transform(float64(number))
|
||||||
}
|
}
|
||||||
if number, ok := val.(float64); ok {
|
if number, ok := val.(float64); ok {
|
||||||
return transform(float64(number))
|
return transform(number)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ func NewJSONTransformer(prefix string, indent string) Transformer {
|
|||||||
if valStr, ok := val.(string); ok {
|
if valStr, ok := val.(string); ok {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
if err := json.Indent(&b, []byte(strings.TrimSpace(valStr)), prefix, indent); err == nil {
|
if err := json.Indent(&b, []byte(strings.TrimSpace(valStr)), prefix, indent); err == nil {
|
||||||
return string(b.Bytes())
|
return b.String()
|
||||||
}
|
}
|
||||||
} else if b, err := json.MarshalIndent(val, prefix, indent); err == nil {
|
} else if b, err := json.MarshalIndent(val, prefix, indent); err == nil {
|
||||||
return string(b)
|
return string(b)
|
||||||
|
|||||||
2
vendor/modules.txt
generated
vendored
2
vendor/modules.txt
generated
vendored
@@ -478,7 +478,7 @@ github.com/inconshreveable/mousetrap
|
|||||||
# github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
|
# github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
|
||||||
## explicit
|
## explicit
|
||||||
github.com/jbenet/go-context/io
|
github.com/jbenet/go-context/io
|
||||||
# github.com/jedib0t/go-pretty/v6 v6.4.3
|
# github.com/jedib0t/go-pretty/v6 v6.4.7
|
||||||
## explicit; go 1.16
|
## explicit; go 1.16
|
||||||
github.com/jedib0t/go-pretty/v6/table
|
github.com/jedib0t/go-pretty/v6/table
|
||||||
github.com/jedib0t/go-pretty/v6/text
|
github.com/jedib0t/go-pretty/v6/text
|
||||||
|
|||||||
Reference in New Issue
Block a user