-
-
Notifications
You must be signed in to change notification settings - Fork 109
Closed
Description
My system: ubuntu 20.04
My tldr version: latest.
In the code:
Lines 194 to 204 in daf1ebf
def get_page(command, remote=None, platforms=None, languages=None): | |
if platforms is None: | |
platforms = get_platform_list() | |
if languages is None: | |
languages = get_language_list() | |
for platform in platforms: | |
for language in languages: | |
if platform is None: | |
continue | |
try: | |
return get_page_for_platform(command, platform, remote, language) |
the tldr client will always try to find the command in linux platform first. So if a command is common (like, ls
, zip
), the tldr
command will first try to find cache file only in <cache_dir>/linux/ls.md
and since the ls.md
is in the <cache_dir>/common/ls.md
, not in the <cache_dir>/linux/ls.md
, the cache failed.
Then, the client will try to get <remote_url>/linux/ls.md
from remote server. and the remote server return 404.
After that, the client will use the platform common
and the cache is found.
I suggest change code like this:
for platform in platforms: # find cache first
try:
load_page_from_cache(command, platform, languate)
except Exception:
continue
for platform in platforms: # if failed , get it from server
try:
load_page_from_server(command, platform, languate)
except Exception:
continue
Metadata
Metadata
Assignees
Labels
No labels