feat: Initial commit
This commit is contained in:
35
Sources/hpa/BuildCommand.swift
Normal file
35
Sources/hpa/BuildCommand.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user