Skip to content

Commit 99980ad

Browse files
committed
fixes
1 parent 07cd473 commit 99980ad

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ DocOpt = "968ba79b-81e4-546f-ab3a-2eecfa62a9db"
99
OutputCollectors = "6c11c7d4-943b-4e2b-80de-f2cfc2930a8c"
1010
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1111
Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b"
12+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1213
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
1314
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1415
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
@@ -21,6 +22,7 @@ DocOpt = "0.5.0"
2122
OutputCollectors = "0.1.1"
2223
Pkg = "1"
2324
Poppler_jll = "21.9"
25+
PrecompileTools = "1.2.1"
2426
ProgressMeter = "1.5"
2527
Random = "1"
2628
Scratch = "1"

src/SearchablePDFs.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ using Scratch
1010
using CSV
1111
using DocOpt
1212

13+
using PrecompileTools: @setup_workload, @compile_workload
14+
1315
using Poppler_jll
1416
using Tesseract_jll
1517

@@ -258,7 +260,7 @@ end
258260
##### CLI interface
259261
#####
260262

261-
doc::String = """Searchable PDFs (OCR).
263+
const doc = """Searchable PDFs (OCR).
262264
263265
Usage:
264266
searchable-pdf <input_pdf> [<output_path>] [--keep_intermediates] [--quiet] [--force] [--logfile=<logfile>] [--tmp=<tmp>] [-n=<ntasks>] [-t=<tesseract_nthreads>]
@@ -291,7 +293,7 @@ function main(args=ARGS)
291293
ntasks = parse(Int, parsed["--ntasks"])
292294
end
293295

294-
tesseract_nthreads = parse(Int, parsed["--tesseract_nthreads"])
296+
tesseract_nthreads = parse(Int, something(get(parsed, "--tesseract_nthreads", nothing), "1"))
295297
result = _main(input_pdf, output_path;
296298
ntasks,
297299
tesseract_nthreads,
@@ -358,4 +360,14 @@ end
358360

359361
precompile(main, (Vector{String},))
360362

363+
@setup_workload begin
364+
@compile_workload begin
365+
docopt(doc, ["test/test.pdf", "--quiet"])
366+
# Could actually run it...
367+
# mktempdir() do tmp
368+
# main([joinpath(pkgdir(SearchablePDFs), "test", "test.pdf"), "$tmp/pdf.pdf", "--quiet"])
369+
# end
370+
end
371+
end
372+
361373
end # module

0 commit comments

Comments
 (0)