feat: Breaking out more dependencies.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import ArgumentParser
|
||||
import CliClient
|
||||
import ConfigurationClient
|
||||
import Dependencies
|
||||
import Foundation
|
||||
import Logging
|
||||
@@ -61,12 +62,14 @@ struct CreateCommand: AsyncParsableCommand {
|
||||
|
||||
private func _run() async throws {
|
||||
try await withSetupLogger(commandName: Self.commandName, globals: globals) {
|
||||
@Dependency(\.coders) var coders
|
||||
@Dependency(\.cliClient) var cliClient
|
||||
@Dependency(\.configuration) var configurationClient
|
||||
@Dependency(\.logger) var logger
|
||||
|
||||
let encoder = cliClient.encoder()
|
||||
let encoder = coders.jsonEncoder()
|
||||
|
||||
let configuration = try cliClient.loadConfiguration()
|
||||
let configuration = try await configurationClient.findAndLoad()
|
||||
|
||||
logger.debug("Configuration: \(configuration)")
|
||||
|
||||
@@ -102,9 +105,9 @@ private func parseOptions(
|
||||
logger: Logger,
|
||||
encoder: JSONEncoder
|
||||
) throws -> Data {
|
||||
let templateDir = command.templateDir ?? configuration.templateDir
|
||||
let templateRepo = command.repo ?? configuration.templateRepo
|
||||
let version = (command.branch ?? configuration.templateRepoVersion) ?? "main"
|
||||
let templateDir = command.templateDir ?? configuration.template.directory
|
||||
let templateRepo = command.repo ?? configuration.template.url
|
||||
let version = (command.branch ?? configuration.template.version) ?? "main"
|
||||
|
||||
logger.debug("""
|
||||
(\(command.localTemplateDir), \(String(describing: templateDir)), \(String(describing: templateRepo)))
|
||||
|
||||
Reference in New Issue
Block a user