Feature Request: Search for appropriate command
gotlougit opened this issue · 7 comments
There are many situations where you know which tool to use and what you want done with it, but you can't exactly recall which command is the one that will do the job. For simpler utilities, tldr <utility-name> will often do the job, but for programs with multiple subcommands (for example, git), this will become very tedious.
I propose having an option to search the tldr pages for keywords. In order to speed it up, the user could specify which utility they want to search in.
It would work as such:
- User wants to know how to delete a branch in git
- Open up terminal and type
tldr git --search="delete branch" - tldr will output something like this:
git branch
Main Git command for working with branches.
More information: https://git-scm.com/docs/git-branch.
- **Delete** a local **branch** (must not have it checked out to do this):
git branch -d branch_name
- **Delete** a remote **branch**:
git push remote_name --delete remote_branch_name
Essentially, the basic overview of the page it got the information from and the relevant entries (the keywords are highlighed but this is optional).
This way we can add yet another good use case for tldr
Thanks for the request @gotlougit. I'm not sure about Python, but generally this is a rather hard task to do. So maybe someone wants to work on this, but I can't promise. If you really need this feature you could try out my C++ client. It's not perfect, but works for the most cases. For example, when you search for "delete branch", you get:

Some tweaks I'd make are:
- Search for each term separately and give a point every time one found within a page. The pages with the highest scores are the best results.
- Only search in lines starting with
-or>.
If you want to highlight the found word you'd have to remember where you found it, but that completely depends on how you implemented the search.
If you're more interested in search engines you could have a look at TF/IDF, which determines how relevant a result is, and the Porter Stemmer, which makes that manager, managing, management, ... are all treated as the same word. Overall, this is really great video about this topic.
I've also noticed the code I wrote was failing the style guidelines, so I'll fix that as well
This commit pretty much solves this, so closing issue.