48 lines
1.2 KiB
Swift
48 lines
1.2 KiB
Swift
import ArgumentParser
|
|
import Dependencies
|
|
import Foundation
|
|
import PlaybookClient
|
|
|
|
struct BuildCommand: AsyncParsableCommand {
|
|
|
|
static let commandName = "build"
|
|
|
|
static let configuration = CommandConfiguration.playbook(
|
|
commandName: commandName,
|
|
abstract: "Build a home performance assesment project.",
|
|
examples: (
|
|
label: "Build project when in the project directory.",
|
|
example: "\(commandName)"
|
|
),
|
|
(
|
|
label: "Build project from outside the project directory.",
|
|
example: "\(commandName) --project-directory /path/to/project"
|
|
)
|
|
)
|
|
|
|
@OptionGroup var globals: GlobalOptions
|
|
|
|
@Option(
|
|
help: "Path to the project directory.",
|
|
completion: .directory
|
|
)
|
|
var projectDirectory: String?
|
|
|
|
@Argument(
|
|
help: "Extra arguments / options passed to the playbook."
|
|
)
|
|
var extraOptions: [String] = []
|
|
|
|
mutating func run() async throws {
|
|
@Dependency(\.playbookClient) var playbookClient
|
|
|
|
try await playbookClient.run.buildProject(.init(
|
|
projectDirectory: projectDirectory,
|
|
shared: globals.sharedPlaybookRunOptions(
|
|
commandName: Self.commandName,
|
|
extraOptions: extraOptions
|
|
)
|
|
))
|
|
}
|
|
}
|