feat: Adds generate-config command.

This commit is contained in:
2024-11-29 20:32:32 -05:00
parent 84b002c997
commit 505f7d8013
8 changed files with 143 additions and 30 deletions

View File

@@ -18,6 +18,7 @@ public struct FileClient: Sendable {
public var homeDir: @Sendable () -> URL = { URL(string: "~/")! }
public var isDirectory: @Sendable (URL) -> Bool = { _ in false }
public var isReadable: @Sendable (URL) -> Bool = { _ in false }
public var write: @Sendable (String, Data) throws -> Void
}
@_spi(Internal)
@@ -31,7 +32,10 @@ extension FileClient: DependencyKey {
loadFile: { try client.loadFile(at: $0, into: &$1, decoder: $2) },
homeDir: { client.homeDir },
isDirectory: { client.isDirectory(url: $0) },
isReadable: { client.isReadable(url: $0) }
isReadable: { client.isReadable(url: $0) },
write: { path, data in
try data.write(to: URL(filePath: path))
}
)
}