Draw the counter reset as a labelled rule across the table
This commit is contained in:
@@ -461,7 +461,7 @@ func run(aName, bName, sizesArg, patArg string,
|
|||||||
d.resetErrors()
|
d.resetErrors()
|
||||||
}
|
}
|
||||||
stats.sinceHeader = 0
|
stats.sinceHeader = 0
|
||||||
fmt.Println(paint("error counts reset", cDim))
|
fmt.Println(stats.rule("error counts reset"))
|
||||||
case now := <-tick.C:
|
case now := <-tick.C:
|
||||||
secs := now.Sub(last).Seconds()
|
secs := now.Sub(last).Seconds()
|
||||||
last = now
|
last = now
|
||||||
|
|||||||
@@ -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 {
|
func (t *streamTable) emit(cells []string) []string {
|
||||||
var out []string
|
var out []string
|
||||||
if t.sinceHeader == 0 || (t.headerEvery > 0 && t.sinceHeader >= t.headerEvery) {
|
if t.sinceHeader == 0 || (t.headerEvery > 0 && t.sinceHeader >= t.headerEvery) {
|
||||||
|
|||||||
Reference in New Issue
Block a user