Skip to content

Commit 3649ddb

Browse files
committed
feat: add method to Progress to return value from 0..1
1 parent 0793a11 commit 3649ddb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/client/pull/events/progress.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ func (p Progress) HumanCurrent() string {
2222
func (p Progress) HumanTotal() string {
2323
return units.HumanSize(float64(p.Total))
2424
}
25+
26+
func (p Progress) Number() float32 {
27+
if p.Total == 0 {
28+
return 0
29+
}
30+
return float32(p.Current) / float32(p.Total)
31+
}

0 commit comments

Comments
 (0)