When using --args in combination with -f, the first positional argument is treated as an input file instead of a positional argument; if you provide -- before positional arguments, it works correctly:
$ gojq -cn --args -f /dev/stdin 1 2 3 <<< '$ARGS, inputs'
{"named":{},"positional":["2","3"]}
gojq: error: open 1: no such file or directory
$ gojq -cn --args -f /dev/stdin -- 1 2 3 <<< '$ARGS, inputs'
{"named":{},"positional":["1","2","3"]}
The problem only occurs if you use -f; if you use an inline script, it works correctly even without --:
When using
--args
in combination with-f
, the first positional argument is treated as an input file instead of a positional argument; if you provide--
before positional arguments, it works correctly:The problem only occurs if you use
-f
; if you use an inline script, it works correctly even without--
: