36 lines
789 B
Swift
36 lines
789 B
Swift
import ArgumentParser
|
|
import CliClient
|
|
import Dependencies
|
|
|
|
struct DecryptCommand: AsyncParsableCommand {
|
|
|
|
static let commandName = "decrypt"
|
|
|
|
static let configuration = CommandConfiguration(
|
|
commandName: commandName,
|
|
abstract: createAbstract("Decrypt a vault file.")
|
|
)
|
|
|
|
@OptionGroup var options: VaultOptions
|
|
|
|
@Option(
|
|
name: .shortAndLong,
|
|
help: "Output file."
|
|
)
|
|
var output: String?
|
|
|
|
mutating func run() async throws {
|
|
@Dependency(\.cliClient) var cliClient
|
|
|
|
var args = ["decrypt"]
|
|
if let output {
|
|
args.append(contentsOf: ["--output", output])
|
|
}
|
|
|
|
try await cliClient.runVaultCommand(
|
|
options.vaultOptions(arguments: args, configuration: nil),
|
|
logging: options.loggingOptions(commandName: Self.commandName)
|
|
)
|
|
}
|
|
}
|