mirror of
https://github.com/zoriya/jjui.git
synced 2026-08-16 02:44:50 +00:00
24 lines
513 B
Go
24 lines
513 B
Go
package parser
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
// ParseRows reads all rows from the provided reader and returns them as a
|
|
// slice. It is used for `jj log` and `jj evolog` commands
|
|
func ParseRows(reader io.Reader) []Row {
|
|
var rows []Row
|
|
controlChan := make(chan ControlMsg)
|
|
defer close(controlChan)
|
|
streamerChannel := ParseRowsStreaming(reader, controlChan, 50, nil)
|
|
for {
|
|
controlChan <- RequestMore
|
|
chunk := <-streamerChannel
|
|
rows = append(rows, chunk.Rows...)
|
|
if !chunk.HasMore {
|
|
break
|
|
}
|
|
}
|
|
return rows
|
|
}
|