Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit 86451e9

Browse files
committed
show download result based on returned value instead of progress value
1 parent 29d0cce commit 86451e9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,13 @@ func doDownload(cmd *flag.FlagSet) {
319319
fmt.Printf("\r%s%% %s %s %s/s", percentStr, progBar, bytesStr, rateStr)
320320
}
321321

322-
if _, err := dl.Download(fname, threads); err != nil {
323-
fmt.Println()
322+
fmt.Println()
323+
if byteCount, err := dl.Download(fname, threads); err != nil {
324324
log.Fatal("download: ", err)
325+
} else {
326+
endTime := time.Now()
327+
fmt.Printf("\nDownloaded %s in %v\n", humanize.Bytes(uint64(byteCount)), endTime.Sub(startTime))
325328
}
326-
fmt.Println()
327-
328-
endTime := time.Now()
329-
fmt.Printf("\nDownloaded %s in %v\n", humanize.Bytes(uint64(progress)), endTime.Sub(startTime))
330329
}
331330
}
332331
}

0 commit comments

Comments
 (0)