Change location of klog config folder #251
Merged
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.
Resolves #250.
The lookup order for klog’s config folder (previously referred to as “klog folder”, residing at
~/.klog
by default on all OS’es) is now this:$KLOG_CONFIG_HOME
(expects full path including the “suffix” bit, so you can also set it to be/foo/bar/all-my-klog-configs
if that fancies you)$XDG_CONFIG_HOME/klog
(for XDG-addicts that stranded on macOS for some reason)$HOME/.klog
(the default / most “idiomatic” config location on macOS for CLI apps)$KLOG_CONFIG_HOME
(see above)$XDG_CONFIG_HOME/klog
$HOME/.config/klog
(the default / most “idiomatic” config location on Linux)%KLOG_CONFIG_HOME%
(see above)%AppData%\klog
(the default / most “idiomatic” config location on Windows)klog iterates through these respective locations, and the first env var that’s set wins. klog will look for (and potentially initialise) the config folder at that location.
By doing
klog --config-folder
, you can see which one it chose, and it also prints the lookup order for reference – e.g., on macOS:For the env var name, I eventually settled on
KLOG_CONFIG_HOME
, as I find that most clear and straightforward.