srsudar / eg

Useful examples at the command line.
MIT License
1.8k stars 98 forks source link

No recognize config path: $HOME/.config/eg/egrc #87

Closed Skabit closed 3 years ago

Skabit commented 3 years ago

Version: 1.2.0 Installed from pip

I follow the information on README of the repository. For custom config file I create a file called egrc on the next path: skabit/.config/eg, but nothing happens. In this file I only add a custom directory with my examples:

[eg-config]
# Lines starting with # are treated as comments
custom-dir = ~/docu/cheats
srsudar commented 3 years ago

Interesting, thanks for reporting. Just to confirm, the content you show there is from skabit/.config/eg/egrc, right?

Do you have an old config file at ~/.egrc maybe that is getting picked up first?

Skabit commented 3 years ago

This issue happens with a fresh installation, I don't have never used eg.

the content you show there is from skabit/.config/eg/egrc, right?

That's right. For now I only want have a custom directory.

I've tested to move the egrc file to home folder (~/.egrc) and works. So the application ignores the other path: ~/.config/eg

srsudar commented 3 years ago

Do you have XDG_CONFIG_HOME set as an environment variable? Can you run echo $XDG_CONFIG_HOME and report what it says?

The XDG spec says it should default to $HOME/.config, but we're leaving it up to the user to enforce the default.

If you do have it set but eg isn't picking it up then I'll have to do some more digging.

Skabit commented 3 years ago

When I run echo $XDG_CONFIG_HOME the output is empty, but this situation is ok, from freedesktop.org:

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

So my config file is ~/.config (remember ~ = $HOME). I use $XDG_CONFIG_HOME because is a standard, is a good news to know than eg use that path for its config file. Maybe python is ignores the path, I don't know.

srsudar commented 3 years ago

Interesting, it looks like I implemented that incorrectly then. It's not python's fault, it's mine. Fortunately it should be an easy fix. For now, you can either put it in the non-XDG location (~/.egrc), or you can set XDG_CONFIG_HOME in your rc files.

Thanks for catching that and for the reference links. Since there's a relatively painless workaround, I'll try to have a fix out within a couple weeks.

srsudar commented 3 years ago

Just published v1.2.1 with the fix. Run pip install --upgrade eg to grab it.

If you still aren't seeing the behavior you want, please let me know. Seems to look good in all of my testing.

Thanks again for pointing it out!

Skabit commented 3 years ago

Wow, thanks @srsudar. Today I updated and voilà, now eg follows the XDG_CONFIG_HOME path.

By the way, great work and useful app, now I test it and spread the word.