Print total size of compressed layers (#60)

Before pulling an image.
This commit is contained in:
Fedor Korotkov 2022-05-10 16:20:52 -04:00 committed by GitHub
parent 4ebec53c77
commit 24375c24f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -52,8 +52,10 @@ extension VMDirectory {
}
// Progress
defaultLogger.appendNewLine("pulling disk...")
let progress = Progress(totalUnitCount: Int64(diskLayers.map{ $0.size }.reduce(0) { $0 + $1 }))
let diskCompressedSize: Int64 = Int64(diskLayers.map {$0.size}.reduce(0) {$0 + $1})
let prettyDiskSize = String(format: "%.1f", Double(diskCompressedSize) / 1_000_000_000.0)
defaultLogger.appendNewLine("pulling disk (\(prettyDiskSize) GB compressed)...")
let progress = Progress(totalUnitCount: diskCompressedSize)
ProgressObserver(progress).log(defaultLogger)
for diskLayer in diskLayers {