"fmt"
"io"
"os"
- "strings"
"sync"
"time"
func CopyProgressed(
dst io.Writer,
src io.Reader,
+ prgrsPrefix string,
sds SDS,
showPrgrs bool,
) (written int64, err error) {
written += int64(nw)
if showPrgrs {
sds["size"] = written
- Progress(sds)
+ Progress(prgrsPrefix, sds)
}
}
if ew != nil {
return
}
-func Progress(sds SDS) {
- pkt := sds["pkt"].(string)
+func Progress(prefix string, sds SDS) {
var size int64
if sizeI, exists := sds["size"]; exists {
size = sizeI.(int64)
}
fullsize := sds["fullsize"].(int64)
+ pkt := sds["pkt"].(string)
progressBarsLock.RLock()
pb, exists := progressBars[pkt]
progressBarsLock.RUnlock()
if len(what) >= 52 { // Base32 encoded
what = what[:16] + ".." + what[len(what)-16:]
}
- if xx, exists := sds["xx"]; exists {
- what = strings.Title(xx.(string)) + " " + what
- }
+ what = prefix + " " + what
pb.Render(what, size)
if size >= fullsize {
pb.Kill()