fix: add showLastProgressBar (#4855)

This commit is contained in:
jiuker
2024-02-22 04:23:55 -08:00
committed by GitHub
parent e6288fa5f3
commit 403bf6bc3a
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -85,6 +85,7 @@ func mainGet(cliCtx *cli.Context) error {
} else {
pg = newAccounter(totalBytes)
}
defer showLastProgressBar(pg)
go func() {
opts := prepareCopyURLsOpts{
sourceURLs: sourceURLs,
+11
View File
@@ -121,6 +121,7 @@ func mainPut(cliCtx *cli.Context) error {
} else {
pg = newAccounter(totalBytes)
}
defer showLastProgressBar(pg)
go func() {
opts := prepareCopyURLsOpts{
sourceURLs: sourceURLs,
@@ -173,3 +174,13 @@ func printPutURLsError(putURLs *URLs) {
"Unable to upload.")
}
}
func showLastProgressBar(pg ProgressReader) {
if progressReader, ok := pg.(*progressBar); ok {
progressReader.ProgressBar.Finish()
} else {
if accntReader, ok := pg.(*accounter); ok {
printMsg(accntReader.Stat())
}
}
}