diff options
Diffstat (limited to 'OCRImage')
-rw-r--r-- | OCRImage/main.swift | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/OCRImage/main.swift b/OCRImage/main.swift index 79d5b4b..cd3fafd 100644 --- a/OCRImage/main.swift +++ b/OCRImage/main.swift @@ -101,7 +101,7 @@ if #available(macOS 10.15,*) {} else { struct OCROptions : ParsableArguments { @Option(help:"Input file for OCR") - var inputFile:String = "/Projects/OCRImage/ExampleInput/sample.png" + var inputFile:String? @Flag(name: .shortAndLong, help:"Show extra debugion info") var debug=false @@ -118,15 +118,26 @@ if options.version { exit(0) } +//exit if input-file isnot set +//if nil == options.inputFile { +// print("Set --input-file command argument to image") +// exit(0) +//} +guard let inputFile = options.inputFile else { + print("ERROR: Set --input-file command argument to image") + exit(0) +} + + +print("OCR Input file: \(inputFile)") -print("OCR Input file: \(options.inputFile)") //Try to open file from URL var fm = FileManager.default.homeDirectoryForCurrentUser //let fm = FileManager.default print(fm) -let path:String = options.inputFile +let path:String = inputFile fm.appendPathComponent(path) let ocrImageUrl = fm.absoluteURL print(fm) |