feat: Begin working on configuration client.

This commit is contained in:
2024-12-22 23:30:25 -05:00
parent 9c62c06ebe
commit d716348088
24 changed files with 958 additions and 409 deletions

View File

@@ -9,17 +9,40 @@ extension CliVersionCommand {
static let configuration: CommandConfiguration = .init(
abstract: "Generates a version file in a command line tool that can be set via the git tag or git sha.",
discussion: "This command can be interacted with directly, outside of the plugin usage context.",
version: VERSION ?? "0.0.0"
subcommands: [BranchStyle.self, SemVarStyle.self],
defaultSubcommand: SemVarStyle.self
)
}
}
extension CliVersionCommand.Generate {
struct BranchStyle: AsyncParsableCommand {
static let configuration: CommandConfiguration = .init(
commandName: "branch",
abstract: "Generates a version file with branch and commit sha as the version.",
discussion: "This command can be interacted with directly, outside of the plugin usage context."
)
@OptionGroup var globals: GlobalOptions
@OptionGroup var globals: GlobalBranchOptions
func run() async throws {
try await globals.run {
@Dependency(\.cliClient) var cliClient
let output = try await cliClient.generate(globals.shared)
print(output)
}
try await globals.shared().run(\.generate)
}
}
struct SemVarStyle: AsyncParsableCommand {
static let configuration: CommandConfiguration = .init(
commandName: "semvar",
abstract: "Generates a version file with SemVar style.",
discussion: "This command can be interacted with directly, outside of the plugin usage context."
)
@OptionGroup var globals: GlobalSemVarOptions
func run() async throws {
try await globals.shared().run(\.generate)
}
}
}