feat: Adds output values to some of the commands to allow them to be piped into other commands
This commit is contained in:
@@ -53,7 +53,7 @@ extension PlaybookClient.RunPlaybook.CreateOptions {
|
||||
}
|
||||
|
||||
extension PlaybookClient.RunPlaybook.GenerateTemplateOptions {
|
||||
func run() async throws {
|
||||
func run() async throws -> String {
|
||||
try await shared.run { arguments, _ in
|
||||
arguments.append(contentsOf: [
|
||||
"--tags", "repo-template",
|
||||
@@ -67,16 +67,21 @@ extension PlaybookClient.RunPlaybook.GenerateTemplateOptions {
|
||||
if !useVault {
|
||||
arguments.append(contentsOf: ["--extra-vars", "use_vault=false"])
|
||||
}
|
||||
|
||||
return templateDirectory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension PlaybookClient.RunPlaybook.SharedRunOptions {
|
||||
|
||||
func run(_ apply: @Sendable @escaping (inout [String], Configuration) throws -> Void) async throws {
|
||||
@discardableResult
|
||||
func run<T>(
|
||||
_ apply: @Sendable @escaping (inout [String], Configuration) throws -> T
|
||||
) async throws -> T {
|
||||
@Dependency(\.commandClient) var commandClient
|
||||
|
||||
try await commandClient.run(
|
||||
return try await commandClient.run(
|
||||
logging: loggingOptions,
|
||||
quiet: quiet,
|
||||
shell: shell
|
||||
@@ -91,9 +96,9 @@ extension PlaybookClient.RunPlaybook.SharedRunOptions {
|
||||
inventoryFilePath: inventoryFilePath
|
||||
)
|
||||
|
||||
try apply(&arguments, configuration)
|
||||
let output = try apply(&arguments, configuration)
|
||||
|
||||
return arguments
|
||||
return (arguments, output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user