mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
size: make output compatible with -P
Before this change the output of `rclone size -P` would get corrupted by the progress printing. This is fixed by using operations.SyncPrintf instead of fmt.Printf. Fixes #7912
This commit is contained in:
parent
4ea629446f
commit
5476da476f
@ -4,7 +4,6 @@ package size
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
@ -73,13 +72,13 @@ of the size command.
|
||||
count := strconv.FormatInt(results.Count, 10)
|
||||
countSuffix := fs.CountSuffix(results.Count).String()
|
||||
if count == countSuffix {
|
||||
fmt.Printf("Total objects: %s\n", count)
|
||||
operations.SyncPrintf("Total objects: %s\n", count)
|
||||
} else {
|
||||
fmt.Printf("Total objects: %s (%s)\n", countSuffix, count)
|
||||
operations.SyncPrintf("Total objects: %s (%s)\n", countSuffix, count)
|
||||
}
|
||||
fmt.Printf("Total size: %s (%d Byte)\n", fs.SizeSuffix(results.Bytes).ByteUnit(), results.Bytes)
|
||||
operations.SyncPrintf("Total size: %s (%d Byte)\n", fs.SizeSuffix(results.Bytes).ByteUnit(), results.Bytes)
|
||||
if results.Sizeless > 0 {
|
||||
fmt.Printf("Total objects with unknown size: %s (%d)\n", fs.CountSuffix(results.Sizeless), results.Sizeless)
|
||||
operations.SyncPrintf("Total objects with unknown size: %s (%d)\n", fs.CountSuffix(results.Sizeless), results.Sizeless)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user