33 lines
736 B
Swift
33 lines
736 B
Swift
import ArgumentParser
|
|
import Dependencies
|
|
import PandocClient
|
|
|
|
// TODO: Need to add a step to build prior to generating file.
|
|
|
|
struct GeneratePdfCommand: AsyncParsableCommand {
|
|
static let commandName = "pdf"
|
|
|
|
static let configuration = CommandConfiguration(
|
|
commandName: commandName
|
|
)
|
|
|
|
@Option(
|
|
name: [.customShort("e"), .customLong("engine")],
|
|
help: "The pdf engine to use."
|
|
)
|
|
var pdfEngine: String?
|
|
|
|
@OptionGroup var globals: GenerateOptions
|
|
|
|
mutating func run() async throws {
|
|
@Dependency(\.pandocClient) var pandocClient
|
|
|
|
let output = try await pandocClient.run.generatePdf(
|
|
globals.pandocRunOptions(commandName: Self.commandName),
|
|
pdfEngine: pdfEngine
|
|
)
|
|
|
|
print(output)
|
|
}
|
|
}
|