-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodegen.swift
More file actions
36 lines (29 loc) · 1.03 KB
/
Codegen.swift
File metadata and controls
36 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import ArgumentParser
import CodegenImpl
import Foundation
@main struct Codegen: ParsableCommand {
@Option(help: "generate client stub for typescript", completion: .directory)
var ts_out: URL?
@Option(name: .shortAndLong, help: "module name of definition")
var module: String?
@Option(name: .shortAndLong, parsing: .singleValue, help: "directory path of dependency module source", completion: .directory)
var dependency: [URL] = []
@Argument(help: "directory path of definition codes", completion: .directory)
var definitionDirectory: URL
@Flag(help: "use import decl of Next.js style")
var nextjs: Bool = false
mutating func run() throws {
try Runner(
definitionDirectory: definitionDirectory,
tsOut: ts_out,
module: module,
dependencies: dependency,
nextjs: nextjs
).run()
}
}
extension URL: ArgumentParser.ExpressibleByArgument {
public init?(argument: String) {
self = URL(fileURLWithPath: argument)
}
}