rust-lang / getopts

The getopts repo maintained by the rust-lang project
https://docs.rs/getopts
Apache License 2.0
233 stars 62 forks source link

Better usage examples #44

Open watzon opened 8 years ago

watzon commented 8 years ago

There are a lot of pieces to this that are uncovered in the example supplied in the docs. More examples would help to better show off how to use this

tromey commented 8 years ago

I'd find it helpful if you could say what specifically would have been useful.

Loris1123 commented 8 years ago

I agree with @iDev0urer . There should be more examples. For example, the beginning of the documentation mentions reqopt but does not tell what it is or how you use it. Also the documentation tells it is possible to create custom options and pass them to getopts.

Another thing, I don't even know if this is possible with getopts, are subcommands, where one command is only available if you specified another command before.

moore3071 commented 7 years ago

One thing that I thought was missing until I looked close at the docs was multi for options and flags (e.g. .optmulti, .optflagmulti. It might be nice to either include these in the main example or in the description mention them in this part of the description:

Construct a vector of options, either by using reqopt, optopt, and optflag or by building them from components yourself, and pass them to getopts

KodrAus commented 6 years ago

More examples are always welcome if anyone would like to submit PRs!