jqlang / jq

Command-line JSON processor
https://jqlang.github.io/jq/
Other
30.23k stars 1.57k forks source link

~/.jq is not sourced on windows #3104

Closed kirkoman closed 1 month ago

kirkoman commented 5 months ago

On Windows, ~/.jq when it is present as a file should be sourced automatically, but it is not.

To be clear, $HOME/.jq is sourced, however HOME is not a standard environment variable on Windows, you must set it manually. The corresponding environment variable on Windows is USERPROFILE.

To Reproduce

# ~/.jq:
def a:
  "a";
C:\Users\me>jq -n "a"
jq: error: a/0 is not defined at <top-level>, line 1:
a
jq: 1 compile error

C:\Users\me>set HOME=%USERPROFILE%

C:\Users\me>jq -n "a"
"a"

Environment