Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Start/done logs when log level is 3 #209

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Sources/Mockolo/Executor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct Executor: ParsableCommand {
help: "Output file path containing the generated Swift mock classes. If no value is given, the program will exit.",
completion: .file())
private var outputFilePath: String

@Option(name: [.customShort("s"), .customLong("sourcedirs")],
parsing: .upToNextOption,
help: "Paths to the directories containing source files to generate mocks for (separated by a space). If the --filelist or --sourcefiles values exist, they will be ignored.",
Expand Down Expand Up @@ -129,11 +129,11 @@ struct Executor: ParsableCommand {
@Flag(name: .long,
help: "If set, a common template function will be called from all functions in mock classes (default is set to false).")
private var useTemplateFunc: Bool = false

init() {
self.defaultTimeout = 20
}

private func fullPath(_ path: String) -> String {
if path.hasPrefix("/") {
return path
Expand Down Expand Up @@ -170,11 +170,19 @@ struct Executor: ParsableCommand {
private var srcs: [String] = []

mutating func run() throws {
print("Start...")
defer { print("Done.") }
let shouldOutputRunStatusMessages: Bool = loggingLevel < 3

if shouldOutputRunStatusMessages {
print("Start...")
}
defer {
if shouldOutputRunStatusMessages {
print("Done.")
}
}

let outputFilePath = fullPath(self.outputFilePath)

var mockFilePaths: [String]?
// First see if a list of mock files are stored in a file
if let mockList = self.mockFileList {
Expand Down