tldr-c-client
tldr-c-client copied to clipboard
Allow customizing the location of `TLDR_HOME`
Currently, TLDR_HOME is hard-coded in src/tldr.h to point to ~/.tldrc.
It would be nice to configure this location via environment variables or a config file. I personally would prefer to set TLDR_HOME to $XDG_DATA_HOME/tldr to comply with the XDG Base Directory Specification and keep my $HOME clean.
Please make this happen!
Hi there, I think it should be $XDG_CACHE_HOME/tldr instead of $XDG_DATA_HOME/tldr. The "manpages" contained there are cache that can be recreated.
Backup systems will typically ignore the $XDG_CACHE_HOME/ (which defaults to ~/.cache/ if undefined), but not $XDG_DATA_HOME/, as the later should contain user data. Cheers!
If this feature is ever implemented, this change should also be made to the shell completions in the autocomplete/ directory, as right now they are hard coded to $HOME/.tldrc/tldr/pages/.
Hi there! Was this finally implemented? I think the bot closed as stale (I don't see a related merge PR or similar).
For anyone interested there's a very performant Rust implementation of tldr that implements Freedesktop.org XDG spec: tealdeer https://github.com/dbrgn/tealdeer
Can be installed with Brew, Nix,...
as I pointed out here
whilst the tldr c client doesnt use XDG it does look for the following environment variable to store the cache
TLDR_CACHE_DIR
This can be used, for example, to achieve
TLDR_CACHE_DIR=“$XDG_CACHE_HOME/tldrc”
Slight clarification on the above, TLDR_CACHE_DIR should likely be set to just $XDG_CACHE_HOME (or whatever else you like) since .tldrc/ is created within the specified directory.
If you set the variable to the suggestion above, at best you will end up with $XDG_CACHE_HOME/tldrc/.tldrc/ hierarchy, if $XDG_CACHE_HOME/tldrc/ already exists, or at worst you will entirely disable caching if it doesn't.
My last comment was a solution was a fudge. Built in XDG support would be better, it still makes sense to have TLDR_CACHE_DIR if you want different from XDG. Depends how it's implemented or reimplemented. You could do the above allowing the user to rename the directory. I don't think having dot file naming convention for files or directories is helpful when already under a dot file or dot directory which XDG paths normally are.
$XDG_CACHE_HOME = $HOME/.config
$XDG_CACHE_HOME/tldrc/.tldrc/ Is just horrible
As is
$XDG_CACHE_HOME/.tldrc/
$XDG_CACHE_HOME/tldrc/ is better ~/.config/tldrc
Don't you think?
I agree and in fact would prefer to have more precise control or proper adherence to XDG (looking at my XDG dirs, tldrc really is the only one using a dot). My comment above was just clarifying the exact current behavior, since it is (to me at least) a bit unexpected.
In a sense I see three issues here:
TLDR_CACHE_DIRname itself is misleading, since it specifies the directory within which the actual cache directory is created, instead of the cache directory itself.- The cache directory name is hardcoded to
.tldrc, which makes it stand out within XDG dirs. - If
TLDR_CACHE_DIRdoesn't exist,tldrdoesn't create the missing directory structure and disables caching altogether.
These three together put you in an awkward position where you either have to set the var to $XDG_CACHE_HOME so that tldr creates .tldrc/ within $XDG_CACHE_HOME/ (which presumably exists), or have to ensure that $XDG_CACHE_HOME/tldrc/ exists, so that tldr can create .tldrc/ within that (which is too much to ask for).