feat: Working create command.
This commit is contained in:
@@ -66,13 +66,13 @@ private struct LiveFileClient: @unchecked Sendable {
|
||||
@Dependency(\.logger) var logger
|
||||
logger.trace("Begin load file for: \(path(for: url))")
|
||||
|
||||
// if url.absoluteString.split(separator: ".json").count > 0 {
|
||||
// // Handle json file.
|
||||
// let data = try Data(contentsOf: url)
|
||||
// let dict = (try? decoder.decode([String: String].self, from: data)) ?? [:]
|
||||
// env.merge(dict, uniquingKeysWith: { $1 })
|
||||
// return
|
||||
// }
|
||||
if url.absoluteString.contains(".json") {
|
||||
// Handle json file.
|
||||
let data = try Data(contentsOf: url)
|
||||
let dict = (try? decoder.decode([String: String].self, from: data)) ?? [:]
|
||||
env.merge(dict, uniquingKeysWith: { $1 })
|
||||
return
|
||||
}
|
||||
|
||||
let string = try String(contentsOfFile: path(for: url), encoding: .utf8)
|
||||
|
||||
@@ -82,7 +82,9 @@ private struct LiveFileClient: @unchecked Sendable {
|
||||
for line in lines {
|
||||
logger.trace("Line: \(line)")
|
||||
let strippedLine = line.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let splitLine = strippedLine.split(separator: "=")
|
||||
let splitLine = strippedLine.split(separator: "=").map {
|
||||
$0.replacingOccurrences(of: "\"", with: "")
|
||||
}
|
||||
logger.trace("Split Line: \(splitLine)")
|
||||
guard splitLine.count >= 2 else { continue }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user