feat: Updating command options.

This commit is contained in:
2024-12-24 10:39:56 -05:00
parent f2a2374c4f
commit 8aa4b73cab
12 changed files with 249 additions and 328 deletions

View File

@@ -7,49 +7,15 @@ extension CliVersionCommand {
static let configuration = CommandConfiguration(
commandName: "bump",
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."
abstract: "Bump version of a command-line tool."
)
@OptionGroup var globals: GlobalBranchOptions
@OptionGroup var globals: GlobalOptions
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.shared().run(\.bump, args: bumpOption)
}
}
}
extension CliClient.BumpOption: EnumerableFlag {}