Closed bobbwest closed 3 years ago
@bobbwest Hmm, I tried reproducing this both on Linux and Mac and I was unable to:
$ oq -V
jq: jq-1.6
oq: 1.2.0
$ oq -i json -o json -n --arg config foo '$config' /dev/null
"foo"
What OS are you on? How did you install jq
? Is it possible it's something with that jq
binary?
EDIT: Also, out of curiosity what happens if you just run jq -n --arg config foo '$config' /dev/null
? Does that also cause the issue?
Ok, that's interesting.
I'm using virgin Ubuntu 20.04 (packages fully updated), jq
installed with apt-get install jq
, oq
installed by downloading the binary from GitHub.
I've isolated the issue to the existence of a directory with the same name as the variable used with --arg
:
$ wget https://github.com/Blacksmoke16/oq/releases/download/v1.2.0/oq-v1.2.0-linux-x86_64
$ chmod +x ./oq-v1.2.0-linux-x86_64
$ ./oq-v1.2.0-linux-x86_64 --version
jq: jq-1.6
oq: 1.2.0
# this works:
$ ./oq-v1.2.0-linux-x86_64 -n --arg config foo '' /dev/null
null
# but not if a directory with the same name as the arg exists:
$ mkdir config
$ ./oq-v1.2.0-linux-x86_64 -n --arg config foo '' /dev/null
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
# remove directory and it works:
$ rmdir config
$ ./oq-v1.2.0-linux-x86_64 -n --arg config foo '' /dev/null
null
The issue is not (specifically) with jq
, as it works fine with the directory:
$ mkdir config
$ jq -n --arg config foo '' /dev/null
null
I've isolated the issue to the existence of a directory with the same name as the variable used with
--arg
:
:pray: This is super helpful thanks
When using a specific variable name (I've found
config
to be an issue) with--arg
,oq
fails with jq 1.6, but works with jq 1.5:jq 1.5:
jq 1.6:
Strangely it works for other variable names: