feat: Adds generate-config command.
This commit is contained in:
@@ -16,6 +16,7 @@ public struct CliClient: Sendable {
|
||||
public var encoder: @Sendable () -> JSONEncoder = { .init() }
|
||||
public var loadConfiguration: @Sendable () throws -> Configuration
|
||||
public var runCommand: @Sendable ([String], Bool, ShellCommand.Shell) async throws -> Void
|
||||
public var createConfiguration: @Sendable (String) throws -> Void
|
||||
|
||||
public func runCommand(
|
||||
quiet: Bool,
|
||||
@@ -41,14 +42,14 @@ extension CliClient: DependencyKey {
|
||||
encoder: JSONEncoder = .init(),
|
||||
env: [String: String]
|
||||
) -> Self {
|
||||
.init {
|
||||
@Dependency(\.fileClient) var fileClient
|
||||
@Dependency(\.logger) var logger
|
||||
|
||||
return .init {
|
||||
decoder
|
||||
} encoder: {
|
||||
encoder
|
||||
} loadConfiguration: {
|
||||
@Dependency(\.logger) var logger
|
||||
@Dependency(\.fileClient) var fileClient
|
||||
|
||||
let urls = try findConfigurationFiles(env: env)
|
||||
var env = env
|
||||
|
||||
@@ -75,6 +76,8 @@ extension CliClient: DependencyKey {
|
||||
in: nil,
|
||||
args
|
||||
))
|
||||
} createConfiguration: { path in
|
||||
try fileClient.write(path, Data(Configuration.fileTemplate.utf8))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user