Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Obscure behavior of Arg.multiple method #2018

Closed
marcospb19 opened this issue Jul 15, 2020 · 1 comment
Closed

[Doc] Obscure behavior of Arg.multiple method #2018

marcospb19 opened this issue Jul 15, 2020 · 1 comment
Labels
A-docs Area: documentation, including docs.rs, readme, examples, etc...
Milestone

Comments

@marcospb19
Copy link
Contributor

marcospb19 commented Jul 15, 2020

I'm trying to learn how to use Clap but I'm having a very hard time with the documentation, here I will try to explain my struggle only for the sake of improvement.

I might just be dumb for the time I wasted stuck on my task xD, but then let's try to understand how a dumb person deals with the documentation and how can we make it better.

Where

https://docs.rs/clap/2.33.1/clap/


I have now realized, a long time being confused how to simply read all args from the CLI with this code.

image

Where is this teached on the docs?

I was very intrigued this is not clearly shown, I see almost every linux CLI tool accepting multiple arguments as a list. but clap's documentation don't teach this at all.

As a former python developer I also found this weird because the first example in python argparse's documentation shows how to receive a variable number of integers and sum them.

What's wrong

Examples containing .multiple(true) show how to accumulate levels of verbosity (-v/--verbose) but don't explain what happen if .multiple(true) is added to an Arg without .short() applied.

This is very obscure, if a short option is not added, then multiple has a totally different behavior/meaning, should clap users be supposed to just figure it out by trial and error? I don't think so.

How to fix

Please consider adding this to the documentation and not throwing it at the examples/ folder, this is to grant the solution visibility.

Adding an example at the start of the documentation that debunks this confusion, here are some suggestions:

A program that receives a list of words and prints them out again, the program accept optional --upper and --lower flags that conflict and transform the output to upper case or lower case.

Or

A calculator that receives numbers and accepts --sum or --mul, and prints out the result of the chained operation (maybe similar to argparse's example?).

Although I have suggested two solutions, I would like to hear external opinions

EDIT: I should also mention that I'm sorry if I sound cocky or offensive on this issue (I'm not a native speaker), but this was obviously not intended by me.

@marcospb19 marcospb19 added the A-docs Area: documentation, including docs.rs, readme, examples, etc... label Jul 15, 2020
@marcospb19
Copy link
Contributor Author

I'm willing try helping with the documentation and create a PR, but I don't know how to build the documentation for this project.

@pksunkara pksunkara added this to the 3.0 milestone Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation, including docs.rs, readme, examples, etc...
Projects
None yet
Development

No branches or pull requests

2 participants