feat: Adds generate commands that call to pandoc to generate pdf, latex, and html files from a project.
This commit is contained in:
15
Sources/TestSupport/WithTempDir.swift
Normal file
15
Sources/TestSupport/WithTempDir.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
import Foundation
|
||||
|
||||
// swiftlint:disable force_try
|
||||
public func withTemporaryDirectory(
|
||||
_ operation: @Sendable (URL) async throws -> Void
|
||||
) async rethrows {
|
||||
let temporaryDirectory = FileManager.default
|
||||
.temporaryDirectory
|
||||
.appending(path: UUID().uuidString)
|
||||
try! FileManager.default.createDirectory(at: temporaryDirectory, withIntermediateDirectories: false)
|
||||
try await operation(temporaryDirectory)
|
||||
try! FileManager.default.removeItem(at: temporaryDirectory)
|
||||
}
|
||||
|
||||
// swiftlint:enable force_try
|
||||
Reference in New Issue
Block a user