lord63 / tldr.py

A python client for tldr: simplified and community-driven man pages.
MIT License
186 stars 18 forks source link

upstream tldr mindlessly changed `master` to `main` #49

Open nopdotcom opened 3 years ago

nopdotcom commented 3 years ago

https://github.com/lord63/tldr.py/blob/4f8065aa3f68a3fec31286030b220cb1042348b3/tldr/cli.py#L139-L145 is now broken.

Update your code to participate in the performance.

lord63 commented 3 years ago

Tested in my local environment, still works. tldr-pages repo still has master branch and it is even with main. But I agree that we should switch to use the main branch in the future. See #50

nopdotcom commented 3 years ago

Yeah, apparently official notice was at https://github.com/tldr-pages/tldr/releases/tag/v1.5b .

They seem pretty adamant that you should be using tldr.zip as a cache, using the term MUST. See https://github.com/tldr-pages/tldr/blob/main/CLIENT-SPECIFICATION.md#caching and note that questions about "what branch are we on" aren't important if you're doing that. The spec was updated here

On the other hand, a .zip file may be the silliest way to distribute tldr. I downloaded their zip file, and recompressed it:

$ ls -lS tldr*
-rw-r--r-- 1 nop wheel 2110917 Jul 18 06:48 tldr.zip
-rw-r--r-- 1 nop wheel  947712 Jul 18 13:07 tldr.tar.gz
-rw-r--r-- 1 nop wheel  888664 Jul 18 13:04 tldr.tar.zst
-rw-r--r-- 1 nop wheel  684995 Jul 18 13:32 tldr.tar.zst18
-rw-r--r-- 1 nop wheel  672568 Jul 18 13:04 tldr.tar.xz

The only thing I can figure out is that they expect you to simply store the zip file, and use zipfile.ZipFile.namelist() and ZipFile.open() as your caching strategy.

(The perfect thing would be generating tldr.tar.xz using https://github.com/vasi/pixz, as just about everybody can read LZMA and tar files these days. Unfortunately, pixz's magic isn't available outside the utility. A Python binding would be cool.)

Should I open a bug on the alleged "MUST" issue to document it, or is this enough?