Make importer async

This commit is contained in:
Sven Weidauer 2022-10-08 11:48:33 +02:00
parent 3adefbf70e
commit 956c1f5d27
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
protocol Importer { protocol Importer {
init(source: String) throws init(source: String) throws
func read() throws -> [String: ColorDef] func read() async throws -> [String: ColorDef]
static var option: String { get } static var option: String { get }
} }

View file

@ -80,7 +80,7 @@ enum HelpTexts {
} }
@main @main
public final class MakeColors: ParsableCommand, Context { public final class MakeColors: AsyncParsableCommand, Context {
@Argument(help: HelpTexts.input) @Argument(help: HelpTexts.input)
var input: String var input: String
@ -101,9 +101,9 @@ public final class MakeColors: ParsableCommand, Context {
public init() {} public init() {}
public func run() throws { public func run() async throws {
let importer = try importer.type.init(source: input) let importer = try importer.type.init(source: input)
let data = try importer.read() let data = try await importer.read()
if dump { if dump {
try dump(data: data) try dump(data: data)