Support $XDG_CONFIG_HOME in module search path#3464
Open
nsfisis wants to merge 2 commits intojqlang:masterfrom
Open
Support $XDG_CONFIG_HOME in module search path#3464nsfisis wants to merge 2 commits intojqlang:masterfrom
nsfisis wants to merge 2 commits intojqlang:masterfrom
Conversation
132e432 to
dabb7dd
Compare
Member
|
I wonder if it would make more sense to skip search path changes and introduce a
and use it in (note that i skipped thinking about windows here) |
Introduce $JQ_CONFIG_HOME as a unified config home directory.
dabb7dd to
650a087
Compare
Author
|
Thank you for review! I introduced The value is determined as follows:
If a user has |
Member
|
Thanks. And i think it makes sense that this should not affect What do other maintainers thinks? it seems reasonable that jq should support XDG_CONFIG_HOME somehow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Add support for the
$XDG_CONFIG_HOMEenvironment variable in module search path, following the XDG Base Directory Specification.Related issue: #2966
Changes
Expand
$JQ_CONFIG_HOMEin module search path like$ORIGIN.The actual value is resolved as follows:
$XDG_CONFIG_HOME/jqif the environment variable$XDG_CONFIG_HOMEis set and the directory exists$HOME/.config/jqif the directory exists$HOME/.jqIn addition, the default module search path is changed:
~/.jq→$JQ_CONFIG_HOME(changed)$ORIGIN/../lib/jq$ORIGIN/../libOriginal Changes
Note
This section describes the original changes before code review.
Expand
$XDG_CONFIG_HOME/in module search path to the value of the environment variable$XDG_CONFIG_HOMElike$ORIGIN.If
$XDG_CONFIG_HOMEis unset or empty,$HOME/.config, which is suggested by XDG Base Directory SpecificationIn addition, add
$XDG_CONFIG_HOME/jqto the default module search path. Search order is as follows:~/.jq$XDG_CONFIG_HOME/jq(added)$ORIGIN/../lib/jq$ORIGIN/../lib~/.jqtakes priority over$XDG_CONFIG_HOME/jqto keep compatibility.References