This commit is contained in:
2023-03-13 17:17:12 -04:00
parent b0559d9726
commit 37f3bfde62
12 changed files with 311 additions and 29 deletions

View File

@@ -0,0 +1,34 @@
import ArgumentParser
import Dependencies
import GitVersion
import ShellClient
@main
public struct GitVersionBuilder: AsyncParsableCommand {
public init() { }
@Argument
var input: String
@Argument
var output: String
public func run() async throws {
@Dependency(\.logger) var logger
@Dependency(\.fileClient) var fileClient
@Dependency(\.shellClient) var shell: ShellClient
logger.debug("Building with input file: \(input)")
logger.debug("Output file: \(output)")
try shell.replacingNilWithVersionString(
in: input
) { update in
logger.debug("Updating with:\n\(update)")
try fileClient.write(string: update, to: output)
}
}
}