lord63 / tldr.py

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

Support rebuild the index. #8

Closed lord63 closed 8 years ago

lord63 commented 8 years ago

Tldr has remove the index build, so the updated pages may still can't be found since the index.json in not the latest. Also, when you add a custom page by yourself, you need to build the index yourself. Maybe we should add a subcommand to support building the index, for example:

$ tldr reindex

or something like this.

Shir0kamii commented 8 years ago

Hi !

You pointed me to this issue, and I have some suggestions after having read more on the subject.

We could use the assets made by Travis to update the dependencies of tldr.py. We can even get rid of the annoying step "clone the tldr repo" by downloading the tldr.zip and using it.

I can probably do a pull request within a week if you like the idea. What's your opinion then ?

igorshubovych commented 8 years ago

Fresh index is always available at: http://tldr-pages.github.io/assets/index.json

igorshubovych commented 8 years ago

It is uploaded there together with pages archive.

lord63 commented 8 years ago

@Shir0kamii @igorshubovych

The reason why I prefer the git repo:

igorshubovych commented 8 years ago

Github has API limits. You will not be able to use it forever.

See what happened to brew: https://gist.github.com/christopheranderton/8644743

lord63 commented 8 years ago

@igorshubovych

Github has API limits. You will not be able to use it forever.

What do you mean by this? I don't use homebrew so I can't get your point. Maybe homebrew use the github API for something but tldr.py just try to pull to fetch the latest pages, does this action also have limits? What's more, I don't think that users will hit this edge cause they won't update so frequently.

igorshubovych commented 8 years ago

tldr.py just try to pull to fetch the latest pages, does this action also have limits?

I made mistake, i thought you were getting the page directly from Github. I just checked that you are doing once: git ls-remote https://github.com/tldr-pages/tldr/ HEAD

In this case you are safe. But those clients which directly read pages from Git, they are not.

lord63 commented 8 years ago

@igorshubovych Tldr.py use the local page in the local repo, it is fast and you can custom your pages. Directly read from the git repo is slow and may hit the limit :)

igorshubovych commented 8 years ago

Yes. Thanks for explanation.

lord63 commented 8 years ago

@Shir0kamii Hi, tldr.py v0.3.0 should support rebuild the index via tldr reindex, have a try!

Shir0kamii commented 8 years ago

@lord63 I just tried and it works fine, thank you for your work. I have a really tiny comment about the message : "Rebuild the index." seems more like a description of the command than a message saying that the index is being rebuilt.

lord63 commented 8 years ago

We need to let the users know that this subcommand works, so puts something to the terminal. Do you have any suggestions, like change the output message to?

igorshubovych commented 8 years ago

How about implementing auto-update every e.g. 30 days. Similar to what Oh-My-Zsh does.

lord63 commented 8 years ago

@igorshubovych Although it is convenient for users, but this seems need more code and may make tldr.py complicated and hard to maintain. I may not support this feature currently. Any ideas?

igorshubovych commented 8 years ago

Check if it was not updated for 30 days, and say warning. This is how it is currently implemented in NodeJS client.

Shir0kamii commented 8 years ago

@lord63 simply "Rebuilding" instead of "Rebuild" should let the user know that it's being done, right ?