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

@@ -7,21 +7,48 @@ extension CliVersionCommand {
static let configuration = CommandConfiguration(
commandName: "bump",
abstract: "Bump version of a command-line tool."
abstract: "Bump version of a command-line tool.",
subcommands: [
SemVarStyle.self,
BranchStyle.self
],
defaultSubcommand: SemVarStyle.self
)
}
}
extension CliVersionCommand.Bump {
struct BranchStyle: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: "branch",
abstract: "Bump using the current branch and commit sha."
)
@OptionGroup var globals: GlobalOptions
@OptionGroup var globals: GlobalBranchOptions
func run() async throws {
try await globals.shared().run(\.bump, args: nil)
}
}
struct SemVarStyle: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: "semvar",
abstract: "Bump using semvar style options."
)
@OptionGroup var globals: GlobalSemVarOptions
@Flag
var bumpOption: CliClient.BumpOption = .patch
func run() async throws {
try await globals.run {
@Dependency(\.cliClient) var cliClient
let output = try await cliClient.bump(bumpOption, globals.shared)
print(output)
}
try await globals.shared().run(\.bump, args: bumpOption)
}
}
}