feat: Integrates precedence with command-line options, needs documentation.
All checks were successful
CI / Ubuntu (push) Successful in 2m31s
All checks were successful
CI / Ubuntu (push) Successful in 2m31s
This commit is contained in:
@@ -60,6 +60,7 @@ extension ConfigCommand {
|
||||
@OptionGroup var globals: ConfigCommandOptions
|
||||
|
||||
func run() async throws {
|
||||
@Dependency(\.logger) var logger
|
||||
let configuration = try await globals
|
||||
.shared(command: Self.commandName)
|
||||
.runClient(\.parsedConfiguration)
|
||||
@@ -183,7 +184,11 @@ private extension ConfigCommand.DumpConfig {
|
||||
private extension ConfigCommand.ConfigCommandOptions {
|
||||
|
||||
func shared(command: String) throws -> CliClient.SharedOptions {
|
||||
try configOptions.shared(command: command, extraOptions: extraOptions, verbose: verbose)
|
||||
try configOptions.shared(
|
||||
command: command,
|
||||
extraOptions: extraOptions,
|
||||
verbose: verbose
|
||||
)
|
||||
}
|
||||
|
||||
func handlePrintJson(_ configuration: Configuration) throws {
|
||||
|
||||
@@ -173,5 +173,19 @@ struct SemVarOptions: ParsableArguments {
|
||||
)
|
||||
var customCommand: Bool = false
|
||||
|
||||
@Option(
|
||||
name: .long,
|
||||
help: """
|
||||
Set the precence to prefer version from file or strategy.
|
||||
"""
|
||||
)
|
||||
var precedence: Configuration.SemVar.Precedence?
|
||||
|
||||
@OptionGroup var preRelease: PreReleaseOptions
|
||||
}
|
||||
|
||||
extension Configuration.SemVar.Precedence: ExpressibleByArgument {
|
||||
public init?(argument: String) {
|
||||
self.init(rawValue: argument)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,11 @@ extension SemVarOptions {
|
||||
""")
|
||||
}
|
||||
|
||||
logger.trace("precedence: \(String(describing: precedence))")
|
||||
|
||||
return try .init(
|
||||
allowPreRelease: !preRelease.disablePreRelease,
|
||||
precedence: precedence,
|
||||
preRelease: customCommand ? nil : preRelease.configPreReleaseStrategy(
|
||||
includeCommitSha: includeCommitSha,
|
||||
extraOptions: extraOptions
|
||||
|
||||
Reference in New Issue
Block a user