Files
SwiftLint/Source/swiftlint/Commands/Version.swift
2024-12-19 12:57:18 -05:00

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()
}
}
}
}