mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
73c88c3af0
Prints out something like this on macOS: ``` Version: 0.49.0-rc.1 Build ID: B43931F3-D096-3704-B41C-FC40673A3F96 ``` This can be used to determine if two `swiftlint` executables are identical.
23 lines
645 B
Swift
23 lines
645 B
Swift
import ArgumentParser
|
|
import SwiftLintFramework
|
|
|
|
extension SwiftLint {
|
|
struct Version: ParsableCommand {
|
|
@Flag(help: "Display full version info")
|
|
var verbose = false
|
|
|
|
static let configuration = CommandConfiguration(abstract: "Display the current version of SwiftLint")
|
|
|
|
static var value: String { SwiftLintFramework.Version.current.value }
|
|
|
|
func run() throws {
|
|
if verbose, let buildID = ExecutableInfo.buildID {
|
|
print("Version:", Self.value)
|
|
print("Build ID:", buildID)
|
|
} else {
|
|
print(Self.value)
|
|
}
|
|
}
|
|
}
|
|
}
|