This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import ArgumentParser
|
||||
import CliClient
|
||||
import Dependencies
|
||||
import Foundation
|
||||
import PlaybookClient
|
||||
|
||||
struct BuildCommand: AsyncParsableCommand {
|
||||
|
||||
@@ -9,29 +10,38 @@ struct BuildCommand: AsyncParsableCommand {
|
||||
static let configuration = CommandConfiguration.playbook(
|
||||
commandName: commandName,
|
||||
abstract: "Build a home performance assesment project.",
|
||||
examples: (label: "Build Project", example: "\(commandName) /path/to/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
|
||||
|
||||
@Argument(
|
||||
@Option(
|
||||
help: "Path to the project directory.",
|
||||
completion: .directory
|
||||
)
|
||||
var projectDir: String
|
||||
var projectDirectory: String?
|
||||
|
||||
@Argument(
|
||||
help: "Extra arguments passed to the playbook."
|
||||
help: "Extra arguments / options passed to the playbook."
|
||||
)
|
||||
var extraArgs: [String] = []
|
||||
var extraOptions: [String] = []
|
||||
|
||||
mutating func run() async throws {
|
||||
try await runPlaybook(
|
||||
commandName: Self.commandName,
|
||||
globals: globals,
|
||||
extraArgs: extraArgs,
|
||||
"--tags", "build-project",
|
||||
"--extra-vars", "project_dir=\(projectDir)"
|
||||
)
|
||||
@Dependency(\.playbookClient) var playbookClient
|
||||
|
||||
try await playbookClient.run.buildProject(.init(
|
||||
projectDirectory: projectDirectory,
|
||||
shared: globals.sharedPlaybookRunOptions(
|
||||
commandName: Self.commandName,
|
||||
extraOptions: extraOptions
|
||||
)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user