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

argument parser doesn't handle = in --arg=value #140

Open
tedil opened this issue Aug 3, 2022 · 5 comments
Open

argument parser doesn't handle = in --arg=value #140

tedil opened this issue Aug 3, 2022 · 5 comments

Comments

@tedil
Copy link

tedil commented Aug 3, 2022

Given an invocation of slivar such as slivar expr --info="INFO.some_integer >= 2" -v slivar-example.vcf, a syntax error occurs:

duko.nim(71) compile
Error: unhandled exception: SyntaxError: parse error (line 1)
expression was:'INFO.some_integer <' [ValueError]

However, replacing >= with > works as expected (same for <= and <).

slivar version: 0.2.7 71af7d12881ae0590c6d2a97ef2b282cc93fe7c6 (installed via bioconda)

I have attached a small VCF file which can be used to reproduce this problem: slivar-example.vcf.txt

@brentp
Copy link
Owner

brentp commented Aug 3, 2022

Can you use single quotes and let me know if the error persists:

slivar expr --info='INFO.some_integer >= 2' -v slivar-example.vcf

I think your shell might be interpreting before it gets to slivar.

@tedil
Copy link
Author

tedil commented Aug 3, 2022

Yes, I thought that is what was happening, too, but it happens with both single and double quotes, and both with bash and zsh.

@brentp
Copy link
Owner

brentp commented Aug 3, 2022

Oh, I see, you can't use --info=... just use `--info '...'
so:

slivar expr --info 'INFO.some_integer >= 2' -v slivar-example.vcf

@tedil
Copy link
Author

tedil commented Aug 3, 2022

Ah, I see, that indeed solves the issue!
The CLI help explicitly states --info='...'. If that is not intended, the help page should reflect that (and error on incorrect usage).

@brentp
Copy link
Owner

brentp commented Aug 4, 2022

Indeed it does. That's a PITA. It's from the argument parser that I'm using.

@brentp brentp changed the title <= and >= comparisons lead to syntax error argument parser doesn't handle = in --arg=value Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants