 let parser = JVArgumentParser()
 
 var error : NSError?
-//let error = AutoreleasingUnsafePointer<NSError?>()
 let dateDetector = NSDataDetector.dataDetectorWithTypes(NSTextCheckingType.Date.toRaw(), error: &error)
 if let error = error {
     printError("Failed to create date parser \(error.localizedDescription)")

parser.addOptionWithArgumentWithLongName("from") { value in startDate = parseDate(value, "Invalid from date") }
parser.addOptionWithArgumentWithLongName("to") { value in endDate = parseDate(value, "Invalid to date") }
parser.addOptionWithArgumentWithLongName("format") { value in
//    let value: String = "FOO"
    switch value as String {
    case "json":
        formatter = JsonOutput()

    retriever.findEvents(startDate: startDate, endDate: endDate) { (events, error) in
        if let events = events {
            formatter.printEvents(events, to: NSFileHandle.fileHandleWithStandardOutput())
        } else if let message = error?.localizedDescription? {
            printError("ERROR: Access to calendar was refused: \(message)");
        } else {
            printError("ERROR: Access to calendar was refused.")
        }
        fetching = false
    }
