Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String input with - doesn't get parsed correctly (even if it is quoted) #114

Closed
ericphanson opened this issue Mar 15, 2021 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@ericphanson
Copy link

ericphanson commented Mar 15, 2021

Over at https://github.com/ericphanson/SearchablePDFs.jl I've been trying out Comonicon to make a command line tool to generate searchable PDFs from rasterized PDFs. E.g.

searchable input.pdf output.pdf

However, if the pdf name has -'s in it, like Author - Year.pdf (generated by Zotero, in my case), then the CLI interprets it as passing options, even if I quote it, like

searchable "Author - Year.pdf" output.pdf

It seems to work OK if the pdf name is like Author-Year.pdf, i.e. without spaces.

@Roger-luo Roger-luo added the bug Something isn't working label Mar 22, 2021
@Roger-luo
Copy link
Collaborator

I think this is now fixed after the rewrite, but I need to tag a release first and there shouldn't be break changes the surface syntax should stay the same, but there could be breaking changes in building binaries.

@ericphanson
Copy link
Author

It seems like spaces still give it trouble, but it doesn't seem to interpret it as a flag anymore which is good, ref ericphanson/SearchablePDFs.jl#5 (comment)

@Roger-luo
Copy link
Collaborator

@ericphanson this is strange... I copy paste the function statement locally and it seems to work, what OS are you using?

# main.jl
using Comonicon

@main function searchable(input_pdf::String,
                          output_path::String=string(splitext(input_pdf)[1], "_OCR",
                                                     ".pdf"); apply_unpaper::Bool=false,
                          ntasks::Int=Sys.CPU_THREADS - 1, tesseract_nthreads::Int=1,
                          keep_intermediates::Bool=false,
                          tmp::String="get_scratch_dir(input_pdf)", quiet::Bool=false,
                          logfile::Union{Nothing,String}=nothing, force::Bool=false)

    println(input_pdf)
end
➜  Comonicon git:(master) ✗ julia main.jl "P - W93.pdf" 
P - W93.pdf
➜  Comonicon git:(master) ✗ 

@Roger-luo
Copy link
Collaborator

Ah I know why, it's because bash will still think "P - W93.pdf" is three tokens!

@ericphanson
Copy link
Author

Huh, I get the same thing with your main.jl,

❯ julia --project=. src/main.jl "P - W93.pdf"
P - W93.pdf

I'm on MacOS (m1 under rosetta).

Oh?

@Roger-luo
Copy link
Collaborator

should be fixed with comonicon/ComoniconBuilder.jl@613fdd4

@Roger-luo
Copy link
Collaborator

I've tagged a new version (run up in pkg mode), please open a new issue if there are still problems.

@ericphanson
Copy link
Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants