1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Use the parser to get our sources out.

This commit is contained in:
Rob Rix 2015-11-02 12:48:21 -05:00
parent 58041d7b6e
commit 6d2729944d

View File

@ -143,9 +143,10 @@ func parserForType(type: String) -> String throws -> Term {
}
}
let arguments = BoundsCheckedArray(array: Process.arguments)
guard let aSource = try arguments[1].map(Source.init) else { throw "need source A" }
guard let bSource = try arguments[2].map(Source.init) else { throw "need source B" }
let parsed = parse(argumentsParser, input: Process.arguments)
let arguments: Argument = try parsed.either(ifLeft: { throw "\($0)" }, ifRight: { $0 })
guard arguments.files.count == 2 else { throw "need two source files" }
let (aSource, bSource) = (arguments.files[0], arguments.files[1])
let jsonURL = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true).URLByAppendingPathComponent("diff.json")
guard let uiPath = NSBundle.mainBundle().infoDictionary?["PathToUISource"] as? String else { throw "need ui path" }
guard aSource.type == bSource.type else { throw "cant compare files of different types" }