Closed sethwoodworth closed 8 years ago
Wow, I don't know that before. Thanks for letting me know that :)
Currently, we just put the configuration file in the user home directory by default, might be a bit dirty.
You can specify the tldr repo anywhere in the configuration file(repo_directory
). You can put it under ./local/share/tldr
if you want.
The reason why I put it under the user home directory is:
~/.pypirc
If we change the default configuration file to $XDG_CONFIG_HOME
, we need:
~/.tlddrc
.appdirs
package to get the right location.questions:
Seems like not a very easy task to support this with just modify a few lines of code. Any ideas?
I'll try to make the changes since I would have prefered these installation directories by default. I'll open a PR when they'll be ready for discussion.
@Shir0kamii Thanks for your kind! :)
Currently, I'm for the currently implementation, maybe a bit dirty but less code and less complexity.
For anyone who interested in this topic, I'll let this issue open and please feel free to leave your comments here. We haven't made the final decision yet.
@Shir0kamii @sethwoodworth Hi, just came out an idea. How about that:
TLDR_CONFIG_DIR
.In this situation, only a few lines of code should be enough :)
benefits:
problems:
XDG_CONFIG_HOME
?Maybe we can add a third step :
TLDR_CONFIG_DIR
.XDG_CONFIG_HOME
.Does it makes sense to you ?
We could also make use of the user data directory to store the pages and index and avoid asking the tldr's page's path. That's just an idea though.
@Shir0kamii No need for a third step, in my opinion. If you feel ok with the configuration file at the home directory, nothing needed form you; if you want to change the default location, set the environment variable TLDR_CONFIG_DIR
.
@Shir0kamii @sethwoodworth Just create a PR to support custom the config directory, have a look! If it is ok, I'll release a new version soon.
@lord63 The XDG_CONFIG_DIRECTORY
is part of the XDG specification and that's why I think it should be supported. But it should be tried after TLDR_CONFIG_DIR to allow a maximun of flexibility. Hence my proposition.
I looked at #16 and adding this third step should be easy with the implementation you chosen.
@Shir0kamii Yes, just one line code should be enough. The reasons why I don't support it are:
$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.
But tldr.py
already take the user's home directory as the default one. If we fellow the spec and change it to $HOME/.config
, this change will be incompatible. So we can't follow the spec .
XDG_CONFIG_HOME
secondly, older users who installed tldr.py
before v0.3.0 will run into the problems that they can't find the configuration file after the update tldr.py
if the environment variable XDG_CONFIG_HOME
exists in their computer.(although double check can avoid this problem)tldr.py
works on them, but I know someone is using it on MAC OS)so, the current PR can let you follow the XDG Base Directory Specification(need some work from the users), and compatible for older users. The patch is simple and solves the problem.
Any ideas?
v0.4.0 supports custom the configuration file via TLDR_CONFIG_DIR
, you can point it to the folder you like, e.g. /home/lord63/.config/tldr/
.
Close it now.
It would be really cool if tldr supported the XDG base directory specification arch wikidebian wiki. In this case, the .tldrrc file would move to ~/.config/tldrrc (in linux). The tldr repo would probably go in
.local/share/tldr
. There is a python package called appdirs that will provide these values for you on at least osx or linux if you're interested!