feat: Moves logging extensions into it's own module, moves configuration merging into config-client, fixes merging bug.

This commit is contained in:
2024-12-25 20:06:52 -05:00
parent fbb4a22e98
commit 56359f3488
11 changed files with 269 additions and 135 deletions

View File

@@ -4,6 +4,7 @@ import DependenciesMacros
import FileClient
import Foundation
import GitClient
import LoggingExtensions
import ShellClient
public extension DependencyValues {
@@ -34,24 +35,6 @@ public struct CliClient: Sendable {
case major, minor, patch, preRelease
}
// TODO: Need a quiet option, as default log level is warning, need a way to set it to ignore logs.
public struct LoggingOptions: Equatable, Sendable {
let command: String
let executableName: String
let verbose: Int
public init(
executableName: String = "bump-version",
command: String,
verbose: Int
) {
self.executableName = executableName
self.command = command
self.verbose = verbose
}
}
public struct SharedOptions: Equatable, Sendable {
let allowPreReleaseTag: Bool
@@ -95,7 +78,9 @@ extension CliClient: DependencyKey {
bump: { try await $1.bump($0) },
generate: { try await $0.generate() },
parsedConfiguration: { options in
try await options.withMergedConfiguration { $0 }
try await options.loggingOptions.withLogger {
try await options.withMergedConfiguration { $0 }
}
}
)
}