// // main.swift // OCRImage // // Created by Jacky Jack on 04/03/2021. // import Foundation import ArgumentParser class TextPiece { var text:String?; var topLeft:CGPoint; var topRight:CGPoint; var bottomLeft:CGPoint; var bottomRIght:CGPoint; init(_ t: String, _ tl:CGPoint, _ tr:CGPoint, _ bl:CGPoint, _ br: CGPoint ) { self.text = t; self.topLeft = tl; self.topRight = tr; self.bottomLeft = bl; self.bottomRIght = br; } } print("Start program") let stderr = FileHandle.standardError if #available(macOS 10.15,*) {} else { //Output to stderr if os version is not supported stderr.write("Version of MacOS should be >=10.15".data(using: .utf8)!) exit(0) } struct OCROptions : ParsableArguments { @Option(help:"Input file for OCR") var inputFile:String = "/Users/jackyjack/Projects/OCRImage/ExampleInput/sample.png" @Flag(name: .shortAndLong, help:"Show extra debugion info") var debug=false @Flag(name:.shortAndLong, help:"Show current version") var version=false } let options = OCROptions.parseOrExit() if options.version { print("Version: 0.0.1") } print("OCR Input file: \(options.inputFile)") print("End programm")