feat: Adds dump-configuration command.
This commit is contained in:
@@ -51,8 +51,8 @@ public struct VaultClient: Sendable {
|
||||
|
||||
@_spi(Internal)
|
||||
public enum Route: String, Equatable, Sendable {
|
||||
case encrypt
|
||||
case decrypt
|
||||
case encrypt
|
||||
|
||||
public var verb: String { rawValue }
|
||||
}
|
||||
@@ -65,12 +65,8 @@ extension VaultClient: DependencyKey {
|
||||
public static var liveValue: VaultClient {
|
||||
.init(
|
||||
run: .init(
|
||||
decrypt: {
|
||||
try await $0.run(route: .decrypt)
|
||||
},
|
||||
encrypt: {
|
||||
try await $0.run(route: .encrypt)
|
||||
}
|
||||
decrypt: { try await $0.run(route: .decrypt) },
|
||||
encrypt: { try await $0.run(route: .encrypt) }
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
27
Sources/hpa/UtilsCommands/DumpConfigCommand.swift
Normal file
27
Sources/hpa/UtilsCommands/DumpConfigCommand.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
import ArgumentParser
|
||||
import CliDoc
|
||||
import ConfigurationClient
|
||||
import CustomDump
|
||||
import Dependencies
|
||||
|
||||
struct DumpConfigCommand: AsyncParsableCommand {
|
||||
static let commandName = "dump-config"
|
||||
|
||||
static let configuration = CommandConfiguration(
|
||||
commandName: commandName,
|
||||
abstract: createAbstract("Show the current configuration."),
|
||||
usage: .default(commandName: commandName, parentCommand: "utils", usesArguments: false, usesExtraArguments: false),
|
||||
discussion: Discussion {
|
||||
"Useful to debug your configuration settings / make sure they load properly."
|
||||
}
|
||||
)
|
||||
|
||||
func run() async throws {
|
||||
@Dependency(\.configurationClient) var configurationClient
|
||||
|
||||
let configuration = try await configurationClient.findAndLoad()
|
||||
|
||||
customDump(configuration)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ struct UtilsCommand: AsyncParsableCommand {
|
||||
These are commands that are generally only run on occasion / less frequently used.
|
||||
""",
|
||||
subcommands: [
|
||||
DumpConfigCommand.self,
|
||||
GenerateProjectTemplateCommand.self,
|
||||
GenerateConfigurationCommand.self,
|
||||
InstallDependenciesCommand.self
|
||||
|
||||
1
Sources/hpa/VaultCommands/EditCommand.swift
Normal file
1
Sources/hpa/VaultCommands/EditCommand.swift
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -24,7 +24,7 @@ struct VaultCommand: AsyncParsableCommand {
|
||||
.separator(.newLine(count: 2))
|
||||
},
|
||||
subcommands: [
|
||||
EncryptCommand.self, DecryptCommand.self
|
||||
DecryptCommand.self, EncryptCommand.self
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user