feat: Begins update for more modern swift-dependencies implementation.

This commit is contained in:
2024-12-20 12:54:10 -05:00
parent 1885a90f62
commit 847ddbc7b5
19 changed files with 439 additions and 130 deletions

View File

@@ -1,6 +1,6 @@
import ArgumentParser
import Foundation
import CliVersion
import Foundation
import ShellClient
extension CliVersionCommand {
@@ -9,15 +9,16 @@ extension CliVersionCommand {
abstract: "Used for the build with version plugin.",
discussion: "This should generally not be interacted with directly, outside of the build plugin."
)
@OptionGroup var shared: SharedOptions
@Option(
name: .customLong("git-directory"),
help: "The git directory for the version."
)
var gitDirectory: String
// TODO: Use CliClient
func run() throws {
try withDependencies {
$0.logger.logLevel = .debug
@@ -29,10 +30,10 @@ extension CliVersionCommand {
@Dependency(\.logger) var logger: Logger
logger.info("Building with git-directory: \(gitDirectory)")
let fileUrl = URL(fileURLWithPath: shared.target)
.appendingPathComponent(shared.fileName)
let fileString = fileUrl.fileString()
logger.info("File Url: \(fileString)")
@@ -40,11 +41,10 @@ extension CliVersionCommand {
let fileContents = buildTemplate
.replacingOccurrences(of: "nil", with: "\"\(currentVersion)\"")
try fileClient.write(string: fileContents, to: fileUrl)
logger.info("Updated version file: \(fileString)")
}
}
}
}