Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

size: include source in JSON output - fixes #5429

Jiacheng Xu35f052e29a00
diff --git a/cmd/size/size.go b/cmd/size/size.go
index a396ddaa1..b30aa5dfe 100644
--- a/cmd/size/size.go
+++ b/cmd/size/size.go
@@ -52,9 +52,10 @@ of the size command.`,
cmd.Run(false, false, command, func() error {
var err error
var results struct {
- Count int64 `json:"count"`
- Bytes int64 `json:"bytes"`
- Sizeless int64 `json:"sizeless"`
+ Count int64 `json:"count"`
+ Bytes int64 `json:"bytes"`
+ Sizeless int64 `json:"sizeless"`
+ Fs string `json:"fs"`
}
results.Count, results.Bytes, results.Sizeless, err = operations.Count(context.Background(), fsrc)
@@ -65,6 +66,7 @@ of the size command.`,
fs.Logf(fsrc, "Size may be underestimated due to %d objects with unknown size", results.Sizeless)
}
if jsonOutput {
+ results.Fs = args[0]
return json.NewEncoder(os.Stdout).Encode(results)
}
count := strconv.FormatInt(results.Count, 10)