lord63 / tldr.py

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

Set "find" as default command #30

Closed onovy closed 6 years ago

onovy commented 6 years ago

Hi,

It would be nice if "find" can be default command and can be omitted.

So this:

onovy@sid~/tmp $ tldr tar
Usage: tldr [OPTIONS] COMMAND [ARGS]...

Error: No such command "tar".
onovy@sid~/tmp $

will show page for 'tar'.

Thanks.

lord63 commented 6 years ago

I'm afraid that this feature won't be accepted. You can set an alias for tldr find, eg:

➜  tldr.py git:(master) ✗ alias tldrf='tldr find'
➜  tldr.py git:(master) ✗ tldrf find
# the output

See the related issues #27

onovy commented 6 years ago

Your arguments:

  1. it's a break change and I don't want to introduce it;
  2. I still prefer subcommand(the way I use now), just like git commit, git rebase. For some complicated cli apps, it is good and easy to extend. For tldr.py, in my opinion, rebuild, find, reindex are different features and they don't fit into the arguments case.

Which is not in collision with my suggestion. What i suggest is to support both:

tldr find tar AND tldr tar

So if first (and only) argument is not valid command (rebuild, find, reindex, update) set "find" as default command and use first argument as page name (find argument).

lord63 commented 6 years ago

it's a break change and I don't want to introduce it;

that's because he suggest the argument style interface, which is a break change.

So if first (and only) argument is not valid command (rebuild, find, reindex, update) set "find" as default command and use first argument as page name (find argument).

If I choose this way, when I type tldr locate, I may want to find the locate usage, not the subcommand usage. Also, as this project growing, I may introduce more subcommands and may be conflict with those existed man pages. In my opinion, this is a if-else detection, but user don't have to know this. So, still prefer the current implementation.