     }
 }
 
-let reportType = readOption("report-type") ?? "text"
+let reportType = readOption("-report-type") ?? "text"
+
+var outputHandle: FileHandle = .standardOutput
+if let outputPath = readOption("o") ?? readOption("-output") {
+  let fileManager = FileManager.default
+  if !fileManager.fileExists(atPath: outputPath) {
+    fileManager.createFile(atPath: outputPath, contents: nil)
+  }
+  if let fileHandle = FileHandle(forWritingAtPath: outputPath) {
+    outputHandle = fileHandle
+  }
+}
 
 let filePaths = cliArgs
 var sourceFiles = [SourceFile]()

}

func readOption(_ option: String) -> String? {
  guard let argIndex = cliArgs.index(of: "--\(option)") else {
    return nil
  }


  sourceFiles.append(sourceFile)
}

let driver = Driver(
  ruleIdentifiers: enabledRules,
  reportType: reportType,
  outputHandle: outputHandle)
let exitCode = driver.lint(sourceFiles: sourceFiles, ruleConfigurations: ruleConfigurations)
exit(exitCode.rawValue)
