I would like to put a function definition in /usr/lib/jq/mytest.jq to be included in my jq script.
From the manual :
The default search path is the search path given to the -L command-line option, else ["~/.jq", "$ORIGIN/../lib/jq", "$ORIGIN/../lib"].
Since jq is in /usr/bin shouldn't /usr/bin/../lib/jq be in the search path? I can't get this command to work:
jq -n 'include "mytest";'
Adding -L /usr/lib/jq to the command works, or I can create a ~/.jq/mytest.jq and that works as well. However, I'd like to use the ~/.jq file for startup. How can I have a startup script and a include search path without specifying -L on the command line??
How can I have a startup script and a include search path without specifying -L on the command line?
Use the module metadata feature, e.g.:
include "mytest" {"search": "/usr/local/lib/jq"};
$ cat /usr/local/lib/jq/mytest.jq
def go: "hello";
$ jq -n 'include "mytest" {"search": "/usr/local/lib/jq"}; go'
"hello"
If you believe there is a mismatch between the current version of jq (1.6) and the corresponding documentation at https://stedolan.github.io/jq/manual/v1.6/ please file a report at https://github.com/stedolan/jq/issues