Skip to content

Commit

Permalink
Merge uber/branch-version
Browse files Browse the repository at this point in the history
Add --version
  • Loading branch information
Ellie Shin committed Aug 31, 2020
1 parent b6760ec commit 6e05afc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Sources/Mockolo/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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")
}

7 changes: 6 additions & 1 deletion Sources/Mockolo/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ import TSCBasic

func main() {
let parser = ArgumentParser(usage: "<options>", 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 {
Expand Down

0 comments on commit 6e05afc

Please sign in to comment.