Add support for XDG_CONFIG_HOME in justfile search paths#2692
Add support for XDG_CONFIG_HOME in justfile search paths#2692pojknamn wants to merge 3 commits intocasey:masterfrom
Conversation
| .join(DEFAULT_JUSTFILE_NAME), | ||
| ); | ||
|
|
||
| if let Some(xdg_config_home) = std::env::var_os("XDG_CONFIG_HOME") { |
There was a problem hiding this comment.
Is the goal to add the option of XDG base directory specification-compliant path for global justfile, or only to use XDG_CONFIG_HOME literally as per documentation?
If the former, checking whether XDG_CONFIG_HOME is set is not the only condition to consider - see related discussion in #2536
There was a problem hiding this comment.
So if I understand the conversation from the linked PR, it doesn't seem like getting full XDG-compliant paths is that hard. The only two concrete examples I could find were relative paths which are not allowed, and empty paths (the environment variable is set, but to an empty value). So you just take the contents of the environment variable, filter out any non-absolute or empty paths, and then default to ~/.config if there's nothing left. Did I get that correct?
Just my $0.02 as the issue submitter, I don't really care either way about this. I love rigorous standards, and it seems good to follow the standard, but if we're not too strict about it, then I can still make sure that the environment variable is set correctly on my end, and everything still works just fine for me. As long as there's something I can fix with my environment, then I can deal with whatever. I just need the documented example to work on all platforms. :)
And thanks for @laniakea64 for doing this, I was going to see about patching this, but I have never done anything in rust, and I hadn't gotten around to it yet. ❤️
There was a problem hiding this comment.
So if I understand the conversation from the linked PR, it doesn't seem like getting full XDG-compliant paths is that hard. ... So you just take the contents of the environment variable, filter out any non-absolute or empty paths, and then default to ~/.config if there's nothing left. Did I get that correct?
Yes, you are correct about full XDG spec compliance.
And thanks for @laniakea64 for doing this, I was going to see about patching this, but I have never done anything in rust, and I hadn't gotten around to it yet. ❤️
😕 I wasn't involved in authoring this PR
There was a problem hiding this comment.
My bad, lol... Thanks to @pojknamn for writing this!!! ❤️ You're a hero!
|
Obviously this needs to rebased onto latest code, but other than that, is this something you'd merge, @casey? I haven't actually needed this for a while as I've primarily been using Windows for a bit, but now I'm back on a mac, and would dearly appreciate having this fix merged. |
$XDG_CONFIG_HOME/just/justfilepath when looking for config files with global optionFixes #2687
feedback welcome, this is my first time contributing rust