mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05: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
|
||||
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
|
||||
// per-column right-align flags and table indentation width (i.e. left
|
||||
// margin width)
|
||||
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
|
||||
@ -410,6 +413,11 @@ func (t *Table) DisplayTable(rows [][]string) error {
|
||||
|
||||
// Print the table with colors
|
||||
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 + "│ ")
|
||||
for c, text := range row {
|
||||
t.RowColors[r].Print(text)
|
||||
|
Loading…
Reference in New Issue
Block a user