Draw the counter reset as a labelled rule across the table
This commit is contained in:
@@ -111,6 +111,31 @@ func (t *streamTable) headerLines() []string {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *streamTable) width() int {
|
||||
w := 0
|
||||
for i, c := range t.cols {
|
||||
w += c.width
|
||||
if i > 0 {
|
||||
w++
|
||||
}
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
||||
// A labelled horizontal rule spanning the table, for marking a break in the
|
||||
// stream of rows.
|
||||
func (t *streamTable) rule(label string) string {
|
||||
const lead = 3
|
||||
text := " " + label + " "
|
||||
trail := t.width() - lead - visWidth(text)
|
||||
if trail < 0 {
|
||||
trail = 0
|
||||
}
|
||||
return paint(strings.Repeat("─", lead), cGrey) +
|
||||
paint(text, cDim) +
|
||||
paint(strings.Repeat("─", trail), cGrey)
|
||||
}
|
||||
|
||||
func (t *streamTable) emit(cells []string) []string {
|
||||
var out []string
|
||||
if t.sinceHeader == 0 || (t.headerEvery > 0 && t.sinceHeader >= t.headerEvery) {
|
||||
|
||||
Reference in New Issue
Block a user