slivar icon indicating copy to clipboard operation
slivar copied to clipboard

argument parser doesn't handle `=` in --arg=value

Open tedil opened this issue 1 year ago • 5 comments

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

tedil avatar Aug 03 '22 08:08 tedil

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.

brentp avatar Aug 03 '22 14:08 brentp

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

tedil avatar Aug 03 '22 15:08 tedil

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

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

brentp avatar Aug 03 '22 17:08 brentp

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).

tedil avatar Aug 03 '22 18:08 tedil

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

brentp avatar Aug 04 '22 15:08 brentp