feat: Integrates vault-client into hpa-executable.

This commit is contained in:
2024-12-16 10:57:14 -05:00
parent da810d0a45
commit 1302b15ee2
4 changed files with 44 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
import ArgumentParser
import CliClient
import VaultClient
// Holds the common options for vault commands, as they all share the
// same structure.
@@ -18,7 +19,7 @@ struct VaultOptions: ParsableArguments {
@Argument(
help: "Extra arguments to pass to the vault command."
)
var extraArgs: [String] = []
var extraOptions: [String] = []
subscript<T>(dynamicMember keyPath: WritableKeyPath<BasicGlobalOptions, T>) -> T {
get { globals[keyPath: keyPath] }
@@ -36,3 +37,25 @@ extension VaultOptions {
globals.loggingOptions(commandName: commandName)
}
}
extension VaultOptions {
func runOptions(
commandName: String,
route: VaultClient.RunOptions.Route,
outputFilePath: String? = nil
) -> VaultClient.RunOptions {
.init(
route,
extraOptions: extraOptions,
loggingOptions: .init(
commandName: commandName,
logLevel: .init(globals: globals, quietOnlyPlaybook: false)
),
outputFilePath: outputFilePath,
quiet: globals.quiet,
shell: globals.shell,
vaultFilePath: file
)
}
}