Skip to content

Commit 7ed03c2

Browse files
authored
Merge pull request #78 from Carthage/nn/add-available-for-enums
Add missing `@available`s to enums
2 parents 903eaec + ffe6766 commit 7ed03c2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Sources/Commandant/Command.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,17 @@ extension CommandRegistry {
217217
@available(*, unavailable, renamed: "CommandProtocol")
218218
public typealias CommandType = CommandProtocol
219219

220+
extension CommandMode {
221+
@available(*, unavailable, renamed: "arguments(_:)")
222+
public static func Arguments(_ parser: ArgumentParser) -> CommandMode {
223+
return .arguments(parser)
224+
}
225+
@available(*, unavailable, renamed: "usage")
226+
public static var Usage: CommandMode {
227+
return .usage
228+
}
229+
}
230+
220231
extension CommandRegistry {
221232
@available(*, unavailable, renamed: "run(command:arguments:)")
222233
public func runCommand(_ verb: String, arguments: [String]) -> Result<(), CommandantError<ClientError>>? {

Sources/Commandant/Errors.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,15 @@ internal func informativeUsageError<ClientError>(_ option: Option<Bool>) -> Comm
146146
// MARK: - migration support
147147
@available(*, unavailable, message: "Use ErrorProtocol instead of ClientErrorType")
148148
public typealias ClientErrorType = Error
149+
150+
extension CommandantError {
151+
@available(*, unavailable, renamed: "usageError(description:)")
152+
public static func UsageError(description: String) -> CommandantError {
153+
return .usageError(description: description)
154+
}
155+
156+
@available(*, unavailable, renamed: "commandError(_:)")
157+
public static func CommandError(_ error: ClientError) -> CommandantError {
158+
return .commandError(error)
159+
}
160+
}

0 commit comments

Comments
 (0)