Improve summary print
This commit is contained in:
parent
225c68ecd1
commit
464ece4a03
@ -3,10 +3,8 @@ import Foundation
|
||||
func checkDependencies() -> Bool {
|
||||
print("--- DEPENDENCIES -----------------------------------")
|
||||
print(" ")
|
||||
let result = checkImageOptimAvailability() && checkMagickAvailability() && checkCwebpAvailability() && checkAvifAvailability()
|
||||
print(" Complete: \(result ? "Yes" : "No")")
|
||||
print(" ")
|
||||
return result
|
||||
defer { print(" ") }
|
||||
return checkImageOptimAvailability() && checkMagickAvailability() && checkCwebpAvailability() && checkAvifAvailability()
|
||||
}
|
||||
|
||||
private func checkImageOptimAvailability() -> Bool {
|
||||
|
@ -110,8 +110,8 @@ private func copyFiles(files: FileData, configuration: Configuration, runFolder:
|
||||
generator.generate()
|
||||
}
|
||||
|
||||
private func finish(start: Date) {
|
||||
print("----------------------------------------------------")
|
||||
private func finish(start: Date, complete: Bool) {
|
||||
print("--- SUMMARY ----------------------------------------")
|
||||
print(" ")
|
||||
let duration = Int(-start.timeIntervalSinceNow.rounded())
|
||||
if duration < 60 {
|
||||
@ -121,11 +121,19 @@ private func finish(start: Date) {
|
||||
} else {
|
||||
print(String(format: " Duration: %d:%02d:%02d", duration / 3600, (duration / 60) % 60, duration % 60))
|
||||
}
|
||||
print(" Complete: \(complete ? "Yes" : "No")")
|
||||
print(" ")
|
||||
print("----------------------------------------------------")
|
||||
}
|
||||
|
||||
private func generate(configPath: String) throws {
|
||||
let start = Date()
|
||||
var complete = false
|
||||
|
||||
defer {
|
||||
// 6. Print summary
|
||||
finish(start: start, complete: complete)
|
||||
}
|
||||
|
||||
print(" ")
|
||||
|
||||
@ -167,6 +175,5 @@ private func generate(configPath: String) throws {
|
||||
// 5. Copy/minify files
|
||||
copyFiles(files: files, configuration: configuration, runFolder: runFolder)
|
||||
|
||||
// 6. Print summary
|
||||
finish(start: start)
|
||||
complete = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user