36 lines
815 B
Swift
36 lines
815 B
Swift
import ArgumentParser
|
|
import CliClient
|
|
import Dependencies
|
|
|
|
struct BuildCommand: AsyncParsableCommand {
|
|
|
|
static let commandName = "build"
|
|
|
|
static let configuration = CommandConfiguration.playbookCommandConfiguration(
|
|
commandName: commandName,
|
|
abstract: "Build a home performance assesment project."
|
|
)
|
|
|
|
@OptionGroup var globals: GlobalOptions
|
|
|
|
@Argument(
|
|
help: "The project directory.",
|
|
completion: .directory
|
|
)
|
|
var projectDir: String
|
|
|
|
@Argument(
|
|
help: "Extra arguments passed to the playbook."
|
|
)
|
|
var extraArgs: [String] = []
|
|
|
|
mutating func run() async throws {
|
|
let args = [
|
|
"--tags", "build-project",
|
|
"--extra-vars", "project_dir=\(projectDir)"
|
|
] + extraArgs
|
|
|
|
try await runPlaybook(commandName: Self.commandName, globals: globals, args: args)
|
|
}
|
|
}
|