()
| 233 | } |
| 234 | |
| 235 | func (m *Meter) str() string { |
| 236 | // (Uploading|Downloading) LFS objects: 100% (10/10) 100 MiB | 10 MiB/s |
| 237 | percentage := 100 * float64(m.finishedFiles) / float64(m.estimatedFiles) |
| 238 | |
| 239 | return fmt.Sprintf("%s: %3.f%% (%d/%d), %s | %s", |
| 240 | m.Direction.Progress(), |
| 241 | percentage, |
| 242 | m.finishedFiles, m.estimatedFiles, |
| 243 | humanize.FormatBytes(clamp(m.currentBytes)), |
| 244 | humanize.FormatByteRate(clampf(m.avgBytes), time.Second)) |
| 245 | } |
| 246 | |
| 247 | // clamp clamps the given "x" within the acceptable domain of the uint64 integer |
| 248 | // type, so as to prevent over- and underflow. |
no test coverage detected