Skip to content

Commit

Permalink
Use the value of $TLDR_MAN_CACHE_DIR for CACHE_DIR if set
Browse files Browse the repository at this point in the history
  • Loading branch information
superatomic committed Aug 13, 2023
1 parent 08033f0 commit af9d673
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tldr_man/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def getenv_dir(key: str, default: Optional[Path] = None) -> Optional[Path]:


def get_cache_dir() -> Path:
return getenv_dir('XDG_CACHE_HOME', Path.home() / '.cache') / CACHE_DIR_NAME
return getenv_dir('TLDR_MAN_CACHE_DIR') or getenv_dir('XDG_CACHE_HOME', Path.home() / '.cache') / CACHE_DIR_NAME


CACHE_DIR: Path = get_cache_dir()
Expand Down
11 changes: 10 additions & 1 deletion tldr-man.1
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,21 @@ being checked last.
If none of these environment variables are set or if no valid pages exist for any of the languages,
this defaults back to
.BR en .
.TP
.BR TLDR_MAN_CACHE_DIR
The location of the page cache directory. This directory is created by the
.B tldr \-\-update
command and is accessed by other commands.
If this variable is not set or is not an absolute path, this defaults back to the value of
.BR $XDG_CACHE_HOME/tldr-man .
.SH "FILES"
.TP
.BR $XDG_CACHE_HOME/tldr_man
The location that the tldr\-pages (in
.BR roff (7)
format) are stored.
format) are stored if the environment variable
.B $TLDR_MAN_CACHE_DIR
is not set or not an absolute path.
This directory is created by running the
.B tldr \-\-update
.R command, and the cache is accessed by
Expand Down

0 comments on commit af9d673

Please sign in to comment.