34 lines
688 B
Swift
34 lines
688 B
Swift
import ArgumentParser
|
|
import CliClient
|
|
import Dependencies
|
|
import VaultClient
|
|
|
|
struct EncryptCommand: AsyncParsableCommand {
|
|
|
|
static let commandName = "encrypt"
|
|
|
|
static let configuration = CommandConfiguration(
|
|
commandName: commandName,
|
|
abstract: createAbstract("Encrypt a vault file.")
|
|
)
|
|
|
|
@Option(
|
|
name: .shortAndLong,
|
|
help: "Output file."
|
|
)
|
|
var output: String?
|
|
|
|
@OptionGroup var options: VaultOptions
|
|
|
|
mutating func run() async throws {
|
|
@Dependency(\.vaultClient) var vaultClient
|
|
|
|
let output = try await vaultClient.run.encrypt(options.runOptions(
|
|
commandName: Self.commandName,
|
|
outputFilePath: output
|
|
))
|
|
|
|
print(output)
|
|
}
|
|
}
|