(count int64, unit string)
| 111 | } |
| 112 | |
| 113 | func (b *ProgressBar) formatBytesInUnit(count int64, unit string) (string, string) { |
| 114 | if unit == "B" { |
| 115 | return strconv.FormatInt(count, 10), unit |
| 116 | } |
| 117 | if unit == "kB" { |
| 118 | return fmt.Sprintf("%0.1f", float64(count)/1_000), unit |
| 119 | } |
| 120 | if unit == "MB" { |
| 121 | return fmt.Sprintf("%0.1f", float64(count)/1_000_000), unit |
| 122 | } |
| 123 | return fmt.Sprintf("%0.1f", float64(count)/1_000_000_000), unit |
| 124 | } |
| 125 | |
| 126 | func NewProgressBar(logger log.Logger) *ProgressBar { |
| 127 | return &ProgressBar{logger, 0} |
no outgoing calls
no test coverage detected