mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
2cf298bf15
Introduced in 4fb5ebe19b due to
https://github.com/swiftlang/swift/issues/59961.
28 lines
894 B
Swift
28 lines
894 B
Swift
import ArgumentParser
|
|
import SwiftLintFramework
|
|
|
|
extension SwiftLint {
|
|
struct Version: AsyncParsableCommand {
|
|
@Flag(help: "Display full version info.")
|
|
var verbose = false
|
|
@Flag(help: "Check whether a later version of SwiftLint is available after processing all files.")
|
|
var checkForUpdates = false
|
|
|
|
static let configuration = CommandConfiguration(abstract: "Display the current version of SwiftLint")
|
|
|
|
static var value: String { SwiftLintFramework.Version.current.value }
|
|
|
|
func run() async {
|
|
if verbose, let buildID = ExecutableInfo.buildID {
|
|
print("Version:", Self.value)
|
|
print("Build ID:", buildID)
|
|
} else {
|
|
print(Self.value)
|
|
}
|
|
if checkForUpdates {
|
|
await UpdateChecker.checkForUpdates()
|
|
}
|
|
}
|
|
}
|
|
}
|