feat: Adds dump-configuration command.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "a3b90cdeec7e11e73a0a47c1f8dffa472c22f0c6385282eb11096210e3e7ad8b",
|
"originHash" : "bc31b11e5e7d488e0a9c1bf91cb572d29f782bfd8e43f44157036f8f3d282893",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "combine-schedulers",
|
"identity" : "combine-schedulers",
|
||||||
@@ -64,6 +64,15 @@
|
|||||||
"version" : "1.3.0"
|
"version" : "1.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"identity" : "swift-custom-dump",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/pointfreeco/swift-custom-dump.git",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
|
||||||
|
"version" : "1.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"identity" : "swift-dependencies",
|
"identity" : "swift-dependencies",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
|
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
|
||||||
|
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "1.3.3"),
|
||||||
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.5.2"),
|
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.5.2"),
|
||||||
.package(url: "https://github.com/m-housh/swift-shell-client.git", from: "0.1.0"),
|
.package(url: "https://github.com/m-housh/swift-shell-client.git", from: "0.1.0"),
|
||||||
.package(url: "https://git.housh.dev/michael/swift-cli-doc.git", from: "0.2.0"),
|
.package(url: "https://git.housh.dev/michael/swift-cli-doc.git", from: "0.2.0"),
|
||||||
@@ -34,6 +35,7 @@ let package = Package(
|
|||||||
"VaultClient",
|
"VaultClient",
|
||||||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||||
.product(name: "CliDoc", package: "swift-cli-doc"),
|
.product(name: "CliDoc", package: "swift-cli-doc"),
|
||||||
|
.product(name: "CustomDump", package: "swift-custom-dump"),
|
||||||
.product(name: "Dependencies", package: "swift-dependencies"),
|
.product(name: "Dependencies", package: "swift-dependencies"),
|
||||||
.product(name: "ShellClient", package: "swift-shell-client")
|
.product(name: "ShellClient", package: "swift-shell-client")
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ public struct VaultClient: Sendable {
|
|||||||
|
|
||||||
@_spi(Internal)
|
@_spi(Internal)
|
||||||
public enum Route: String, Equatable, Sendable {
|
public enum Route: String, Equatable, Sendable {
|
||||||
case encrypt
|
|
||||||
case decrypt
|
case decrypt
|
||||||
|
case encrypt
|
||||||
|
|
||||||
public var verb: String { rawValue }
|
public var verb: String { rawValue }
|
||||||
}
|
}
|
||||||
@@ -65,12 +65,8 @@ extension VaultClient: DependencyKey {
|
|||||||
public static var liveValue: VaultClient {
|
public static var liveValue: VaultClient {
|
||||||
.init(
|
.init(
|
||||||
run: .init(
|
run: .init(
|
||||||
decrypt: {
|
decrypt: { try await $0.run(route: .decrypt) },
|
||||||
try await $0.run(route: .decrypt)
|
encrypt: { try await $0.run(route: .encrypt) }
|
||||||
},
|
|
||||||
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.
|
These are commands that are generally only run on occasion / less frequently used.
|
||||||
""",
|
""",
|
||||||
subcommands: [
|
subcommands: [
|
||||||
|
DumpConfigCommand.self,
|
||||||
GenerateProjectTemplateCommand.self,
|
GenerateProjectTemplateCommand.self,
|
||||||
GenerateConfigurationCommand.self,
|
GenerateConfigurationCommand.self,
|
||||||
InstallDependenciesCommand.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))
|
.separator(.newLine(count: 2))
|
||||||
},
|
},
|
||||||
subcommands: [
|
subcommands: [
|
||||||
EncryptCommand.self, DecryptCommand.self
|
DecryptCommand.self, EncryptCommand.self
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user