Don't print out the 'info' column when there is nothing to display. (#2027)

This commit is contained in:
CyrusNajmabadi 2018-10-05 13:03:30 -07:00 committed by GitHub
parent 4ec76981f6
commit 84c2a23acc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -587,15 +587,10 @@ func (display *ProgressDisplay) refreshAllRowsIfInTerminal() {
var maxColumnLengths []int
display.convertNodesToRows(rootNodes, maxSuffixLength, &rows, &maxColumnLengths)
for i, row := range rows {
var id string
if i == 0 {
id = "#"
} else {
id = fmt.Sprintf("%v", i)
}
removeInfoColumnIfUnneeded(rows)
display.refreshColumns(id, row, maxColumnLengths)
for i, row := range rows {
display.refreshColumns(fmt.Sprintf("%v", i), row, maxColumnLengths)
}
systemID := len(rows)
@ -630,6 +625,19 @@ func (display *ProgressDisplay) refreshAllRowsIfInTerminal() {
}
}
func removeInfoColumnIfUnneeded(rows [][]string) {
// If there have been no info messages, then don't print out the info column header.
for i := 1; i < len(rows); i++ {
row := rows[i]
if row[len(row)-1] != "" {
return
}
}
firstRow := rows[0]
firstRow[len(firstRow)-1] = ""
}
// Performs all the work at the end once we've heard about the last message from the engine.
// Specifically, this will update the status messages for any resources, and will also then
// print out all final diagnostics. and finally will print out the summary.