feat: Working on moving commands to cli-client

This commit is contained in:
2024-12-12 07:46:26 -05:00
parent 8302ede99e
commit ce6eb3ec2f
13 changed files with 134 additions and 199 deletions

View File

@@ -36,6 +36,7 @@ struct GenerateProjectTemplateCommand: AsyncParsableCommand {
)
var extraArgs: [String] = []
// FIX:
mutating func run() async throws {
let varsDir = templateVars != nil
? ["--extra-vars", "repo_vars_dir=\(templateVars!)"]
@@ -43,15 +44,15 @@ struct GenerateProjectTemplateCommand: AsyncParsableCommand {
let vault = noVault ? ["--extra-vars", "use_vault=false"] : []
try await runPlaybook(
commandName: Self.commandName,
globals: globals,
extraArgs: extraArgs,
[
"--tags", "repo-template",
"--extra-vars", "output_dir=\(path)"
] + varsDir
+ vault
)
// try await runPlaybook(
// commandName: Self.commandName,
// globals: globals,
// extraArgs: extraArgs,
// [
// "--tags", "repo-template",
// "--extra-vars", "output_dir=\(path)"
// ] + varsDir
// + vault
// )
}
}

View File

@@ -55,17 +55,17 @@ struct GenerateConfigurationCommand: AsyncParsableCommand {
let actualPath: String
if let path {
actualPath = "\(path)/config"
} else {
let path = "~/.config/hpa-playbook/"
try await cliClient.runCommand(
quiet: false,
shell: globals.shellOrDefault,
"mkdir", "-p", path
)
actualPath = "\(path)/config"
}
// if let path {
// actualPath = "\(path)/config"
// } else {
// let path = "~/.config/hpa-playbook/"
// try await cliClient.runCommand(
// quiet: false,
// shell: globals.shellOrDefault,
// "mkdir", "-p", path
// )
// actualPath = "\(path)/config"
// }
fatalError()
// try cliClient.createConfiguration(actualPath, json)