lord63 / tldr.py

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

Add autocompletion #29

Closed kernicPanel closed 6 years ago

kernicPanel commented 6 years ago

Hi As I'm coming from cheat, I borrowed them this : https://github.com/chrisallenlane/cheat/wiki/Enabling-Command-line-Autocompletion

I don't know if the added test is well done, but they're all passing with python 3.6.

After copying autocompletion/tldr.bash to /etc/bash_completion.d/ (on ubuntu), autocompletion will be available like this :

~/tldr.py$ tldr find ta[tab]
tabula  tac     tail    tar     task
codecov-io commented 6 years ago

Codecov Report

Merging #29 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #29   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           4      4           
  Lines         158    170   +12     
=====================================
+ Hits          158    170   +12
Impacted Files Coverage Ξ”
tldr/cli.py 100% <100%> (ΓΈ) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 1235ad1...3d37670. Read the comment docs.

lord63 commented 6 years ago

Hey, it looks great! πŸ‘ I'll look into this feature this weekend, will ping you back if I have some ideas :)

kernicPanel commented 6 years ago

Hi I've reworked on this PR from this http://click.pocoo.org/5/bashcomplete/ Now all commands levels are completed:

~/tldr.py$ tldr [tab]
find     init     list     locate   reindex  update

~/tldr.py$ tldr find ta[tab]
tabula  tac     tail    tar     task

Only find and locate commands gets completed with page names.

lord63 commented 6 years ago

@kernicPanel Hi, sorry for the late response. Changed my job recently, new place, new work, new life, pretty busy these day. I'll try to get some time to review this pr these days.

kernicPanel commented 6 years ago

Hi, @lord63 No problem, there's no rush wish this. I wish you're enjoying your new life :slightly_smiling_face:

Just a question, do you prefer PR into master or dev ?

lord63 commented 6 years ago

Ah, seems I missed the PR again. I've changed the base to dev and I'll merge it.

We'll add zsh autocompletion in the future. Thanks you again. πŸŽ† πŸŽ† πŸŽ†