Blacksmoke16 / oq

A performant, and portable jq wrapper to facilitate the consumption and output of formats other than JSON; using jq filters to transform the data.
https://blacksmoke16.github.io/oq/
MIT License
190 stars 15 forks source link

oq fails to forward --arg to jq #42

Closed potyl closed 4 years ago

potyl commented 4 years ago

jq accepts arguments through --arg VARNAME value when oq is being passed one it fails to forward it to jq as it passes --arg VARNAME only and this results in a broken command:

strace -f -e execve oq -i yaml --arg VARNAME value '[1]' /dev/null

results in:

execve("/usr/local/bin/oq", ["oq", "-i", "yaml", "--arg", "VARNAME", "value", "[1]", "/dev/null"], 0x7ffe1c200eb8 /* 92 vars */) = 0

[pid 27961] execve("/usr/bin/jq", ["jq", "--arg", "VARNAME"], 0x7ffe12681ac0 /* 92 vars */) = 0
jq: --arg takes two parameters (e.g. --arg varname value)
Use jq --help for help with command-line options,
or see the jq manpage, or online docs  at https://stedolan.github.io/jq
oq error: Error opening file 'value' with mode 'r': No such file or directory
Blacksmoke16 commented 4 years ago

I'll have a fix for this this weekend, busy with the holidays. I'll also check the other jq options, this issue would exist for like jsonarg as well.