Skip to content

Commit

Permalink
refactor print function
Browse files Browse the repository at this point in the history
  • Loading branch information
djelusic committed Nov 11, 2021
1 parent 3a85851 commit 7d9f969
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cli/ui/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,16 @@ func (p *Progress) printLoop() {
}

func (p *Progress) print() {
out := p.prefix
add := func(s string) {
p.printFunc(p.writer, s)
}
add(p.prefix)
for _, e := range p.elements {
out += e.Current()
add(e.Current())
}
if p.isDone() {
out += ", done."
add(", done.")
}
p.printFunc(p.writer, out)
p.writer.Flush()
}

Expand Down

0 comments on commit 7d9f969

Please sign in to comment.