mirror of
https://github.com/minio/minio.git
synced 2025-04-21 11:04:20 -04:00
Header row seperator for console Table (#10651)
This commit is contained in:
parent
8ceb2a93fd
commit
abb14aeec1
@ -353,13 +353,16 @@ type Table struct {
|
|||||||
|
|
||||||
// Left margin width for table
|
// Left margin width for table
|
||||||
TableIndentWidth int
|
TableIndentWidth int
|
||||||
|
|
||||||
|
// Flag to print separator under heading. Row 0 is considered heading
|
||||||
|
HeaderRowSeparator bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTable - create a new Table instance. Takes per-row colors and
|
// NewTable - create a new Table instance. Takes per-row colors and
|
||||||
// per-column right-align flags and table indentation width (i.e. left
|
// per-column right-align flags and table indentation width (i.e. left
|
||||||
// margin width)
|
// margin width)
|
||||||
func NewTable(rowColors []*color.Color, alignRight []bool, indentWidth int) *Table {
|
func NewTable(rowColors []*color.Color, alignRight []bool, indentWidth int) *Table {
|
||||||
return &Table{rowColors, alignRight, indentWidth}
|
return &Table{rowColors, alignRight, indentWidth, false}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisplayTable - prints the table
|
// DisplayTable - prints the table
|
||||||
@ -410,6 +413,11 @@ func (t *Table) DisplayTable(rows [][]string) error {
|
|||||||
|
|
||||||
// Print the table with colors
|
// Print the table with colors
|
||||||
for r, row := range paddedText {
|
for r, row := range paddedText {
|
||||||
|
if t.HeaderRowSeparator && r == 1 {
|
||||||
|
// Draw table header-row border
|
||||||
|
border = fmt.Sprintf("%s├%s┤", indentText, strings.Join(segments, "┼"))
|
||||||
|
fmt.Println(border)
|
||||||
|
}
|
||||||
fmt.Print(indentText + "│ ")
|
fmt.Print(indentText + "│ ")
|
||||||
for c, text := range row {
|
for c, text := range row {
|
||||||
t.RowColors[r].Print(text)
|
t.RowColors[r].Print(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user