tldr-pages / tldr-python-client

:snake: Python command-line client for tldr pages 📚
https://pypi.org/project/tldr/
MIT License
599 stars 95 forks source link

Syntax for listing multiple commands is ambiguous #75

Closed MasterOdin closed 4 years ago

MasterOdin commented 5 years ago

The python client allows one to specify multiple commands to show their pages at the same time, for example tldr wget curl, which will show you both wget and curl.

Additionally, it allows you to specify a command without specifying its hyphen, for example tldr ansible galaxy is equivalent to tldr ansible-galaxy.

If trying to specify multiple commands, you cannot look at commands that have hyphens and use the above syntax (you must specify the hyphen).

Example: tldr ansible ansible galaxy or tldr ansible galaxy ansible

I'd expect to see the ansible-galaxy page and the ansible page. Instead, it shows the ansible page twice and a warning about how the galaxy page does not exist and I should consider creating one.

It looks like if you wish to use spaces for a command's name, you must use the hyphen. Would it make sense to allow one to always be able to specify the space?


edit (04/23/2020):

For a better example of confusing behavior, typing tldr git grep returns git-grep but did the user mean that or to get back both git and grep separately?

JCGoran commented 5 years ago

Would it make sense to allow one to always be able to specify the space?

There seem to be at least two issues:

  1. the number of hyphens is not restricted to one (for example there is git-cherry-pick), and tldr would have to check all possible hyphen combos (easy).
  2. biggest issue IMHO is that there may be name collisions. Take for instance git-patch-id. If you run man git-patch-id, you get the man page of this particular git command, but if you run man git patch id, it shows you 3 different man pages since the 3 programs exist independently, so if no-hyphen-support is implemented in tldr as in man, sometimes the user may not get what they expect.
zlatanvasovic commented 4 years ago

For the record, the official command name is ansible-galaxy (with a hyphen) as you can see in ansible-galaxy.md.

Though this function may be useful, it is impossible to implement it functionally (as @JCGoran nicely explained). It is also in conflict with the official client specification, as it makes the hyphen insertion ambiguous.

I'm closing this for now. If other collaborators see some special way to actually implement this, this issue should be reopened.

waldyrious commented 4 years ago

@zdroid while I agree that it is unlikely that we'll be able to support showing pages for multiple commands with a single invocation of tldr (without making that ambiguous with hiphenated commands, that is), the fact is that the Python client already implements this behavior, as @MasterOdin mentions in the opening comment.

So if anything, this issue should remain open to track the removal of that functionality from this client, for the reasons you and @JCGoran raised above.

zlatanvasovic commented 4 years ago

I didn't see that aspect, but you are right. This issue is a good thread for the removal of this conflicting feature.