MCPcopy Create free account
hub / github.com/UiPath/uipathcli / renderProgress

Method renderProgress

utils/visualization/progress_bar.go:73–90  ·  view source on GitHub ↗
(text string, currentBytes int64, totalBytes int64, bytesPerSecond int64)

Source from the content-addressed store, hash-verified

71}
72
73func (b *ProgressBar) renderProgress(text string, currentBytes int64, totalBytes int64, bytesPerSecond int64) int {
74 percent := math.Min(float64(currentBytes)/float64(totalBytes)*100.0, 100.0)
75 bar := b.createBar(percent)
76 totalBytesFormatted, unit := b.formatBytes(totalBytes)
77 currentBytesFormatted, unit := b.formatBytesInUnit(currentBytes, unit)
78 bytesPerSecondFormatted, bytesPerSecondUnit := b.formatBytes(bytesPerSecond)
79 output := fmt.Sprintf("%s %3d%% |%s| (%s/%s %s, %s %s/s)",
80 text,
81 int(percent),
82 bar,
83 currentBytesFormatted,
84 totalBytesFormatted,
85 unit,
86 bytesPerSecondFormatted,
87 bytesPerSecondUnit)
88 b.logger.LogError(output)
89 return utf8.RuneCountInString(output)
90}
91
92func (b *ProgressBar) createBar(percent float64) string {
93 barCount := int(percent / 5.0)

Callers 1

UpdateProgressMethod · 0.95

Calls 4

createBarMethod · 0.95
formatBytesMethod · 0.95
formatBytesInUnitMethod · 0.95
LogErrorMethod · 0.65

Tested by

no test coverage detected