'update'
This commit is contained in:
22
ipad_app/Sources/CLIMain.swift
Normal file
22
ipad_app/Sources/CLIMain.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import Foundation
|
||||
|
||||
@available(macOS 10.15, iOS 13.0, *)
|
||||
@main
|
||||
struct CLIMain {
|
||||
static func main() async {
|
||||
guard CommandLine.arguments.count > 1 else {
|
||||
print("用法: IpadReaderCLI <bundle.zip>")
|
||||
return
|
||||
}
|
||||
let zipPath = CommandLine.arguments[1]
|
||||
let url = URL(fileURLWithPath: zipPath)
|
||||
let importer = BundleImporter()
|
||||
do {
|
||||
let idx = try await importer.importZipFile(at: url)
|
||||
print("导入成功,书籍数: \(idx.books.count)")
|
||||
print("统计: 年总时长 \(idx.stats.global.year_total_minutes/60) 小时")
|
||||
} catch {
|
||||
print("导入失败: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user