feat: Adds generate commands that call to pandoc to generate pdf, latex, and html files from a project.
This commit is contained in:
@@ -39,14 +39,13 @@ private func install(config: Configuration.Playbook?) async throws {
|
||||
@Dependency(\.logger) var logger
|
||||
@Dependency(\.asyncShellClient) var shell
|
||||
|
||||
let path = config?.directory ?? PlaybookClient.Constants.defaultInstallationPath
|
||||
let version = config?.version ?? PlaybookClient.Constants.playbookRepoVersion
|
||||
let (path, version) = parsePlaybookPathAndVerion(config)
|
||||
|
||||
let parentDirectory = URL(filePath: path)
|
||||
.deletingLastPathComponent()
|
||||
|
||||
let exists = try await fileClient.isDirectory(parentDirectory)
|
||||
if !exists {
|
||||
let parentExists = try await fileClient.isDirectory(parentDirectory)
|
||||
if !parentExists {
|
||||
try await fileClient.createDirectory(parentDirectory)
|
||||
}
|
||||
|
||||
@@ -70,3 +69,10 @@ private func install(config: Configuration.Playbook?) async throws {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
private func parsePlaybookPathAndVerion(_ configuration: Configuration.Playbook?) -> (path: String, version: String) {
|
||||
return (
|
||||
path: configuration?.directory ?? PlaybookClient.Constants.defaultInstallationPath,
|
||||
version: configuration?.version ?? PlaybookClient.Constants.playbookRepoVersion
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user