This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import ArgumentParser
|
||||
import CommandClient
|
||||
import VaultClient
|
||||
|
||||
// Holds the common options for vault commands, as they all share the
|
||||
// same structure.
|
||||
@@ -17,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] }
|
||||
@@ -29,3 +31,23 @@ struct VaultOptions: ParsableArguments {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension VaultOptions {
|
||||
|
||||
func runOptions(
|
||||
commandName: String,
|
||||
outputFilePath: String? = nil
|
||||
) -> VaultClient.RunOptions {
|
||||
.init(
|
||||
extraOptions: extraOptions,
|
||||
loggingOptions: .init(
|
||||
commandName: commandName,
|
||||
logLevel: .init(globals: globals, quietOnlyPlaybook: false)
|
||||
),
|
||||
outputFilePath: outputFilePath,
|
||||
quiet: globals.quiet,
|
||||
shell: globals.shell,
|
||||
vaultFilePath: file
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user