feat: Some parameter renaming for consistency
All checks were successful
CI / Ubuntu (push) Successful in 2m36s

This commit is contained in:
2024-12-31 08:31:41 -05:00
parent 147f6df1b3
commit 016f0d6c3f
6 changed files with 39 additions and 45 deletions

View File

@@ -29,7 +29,7 @@ extension CliClient.SharedOptions {
}
// This will fail if the target url is not set properly.
let targetUrl = try configuration.targetUrl(gitDirectory: projectDirectory)
let targetUrl = try configuration.targetUrl(projectDirectory: projectDirectory)
logger.debug("Target: \(targetUrl.cleanFilePath)")
// Perform the operation, which generates the new version and writes it.
@@ -82,19 +82,19 @@ extension CliClient.SharedOptions {
@Dependency(\.logger) var logger
logger.trace("Begin writing version.")
let hasChanges: Bool
// let hasChanges: Bool
let targetUrl: URL
let usesOptionalType: Bool
let versionString: String?
switch currentVersion {
case let .branch(branch):
hasChanges = branch.hasChanges
// hasChanges = branch.hasChanges
targetUrl = branch.targetUrl
usesOptionalType = branch.usesOptionalType
versionString = branch.versionString
case let .semvar(semvar):
hasChanges = semvar.hasChanges
// hasChanges = semvar.hasChanges
targetUrl = semvar.targetUrl
usesOptionalType = semvar.usesOptionalType
versionString = semvar.versionString(withPreRelease: allowPreReleaseTag)
@@ -132,11 +132,7 @@ extension CliClient.SharedOptions {
}
}
func bump(_ type: CliClient.BumpOption?) async throws -> String {
guard let type else {
return try await generate()
}
func bump(_ type: CliClient.BumpOption) async throws -> String {
return try await run { container in
@Dependency(\.logger) var logger
@@ -175,3 +171,15 @@ extension CliClient.SharedOptions {
}
}
}
private extension CurrentVersionContainer where Version == SemVar {
func withUpdateNextVersion(_ next: SemVar) -> Self {
.init(
targetUrl: targetUrl,
usesOptionalType: usesOptionalType,
loadedVersion: loadedVersion,
precedence: .strategy, // make sure to use the next version, since it was specified, as this is called from `bump`.
strategyVersion: next
)
}
}