diff --git a/Sources/Mockolo/Executor.swift b/Sources/Mockolo/Executor.swift index 0c867dc5..b61e4f3f 100644 --- a/Sources/Mockolo/Executor.swift +++ b/Sources/Mockolo/Executor.swift @@ -56,8 +56,9 @@ class Executor { /// /// - parameter parser: The argument parser to use. private func setupArguments(with parser: ArgumentParser) { + loggingLevel = parser.add(option: "--logging-level", - shortName: "-v", + shortName: "-l", kind: Int.self, usage: "The logging level to use. Default is set to 0 (info only). Set 1 for verbose, 2 for warning, and 3 for error.") sourceFiles = parser.add(option: "--sourcefiles", @@ -145,6 +146,7 @@ class Executor { return FileManager.default.currentDirectoryPath + "/" + path } + /// Execute the command. /// /// - parameter arguments: The command line arguments to execute the command with. @@ -218,3 +220,12 @@ class Executor { } } } + +public struct Version { + /// The string value for this version. + public let value: String + + /// The current Mockolo version. + public static let current = Version(value: "1.2.5") +} + diff --git a/Sources/Mockolo/main.swift b/Sources/Mockolo/main.swift index ed1c0c8a..960dda9f 100644 --- a/Sources/Mockolo/main.swift +++ b/Sources/Mockolo/main.swift @@ -19,8 +19,13 @@ import TSCBasic func main() { let parser = ArgumentParser(usage: "", overview: "Mockolo: Swift mock generator.") - let command = Executor(parser: parser) let inputs = Array(CommandLine.arguments.dropFirst()) + if let arg = inputs.first, (arg == "--version" || arg == "-v") { + print(Version.current.value) + return + } + + let command = Executor(parser: parser) print("Start...") do {