getopts
getopts copied to clipboard
Better usage examples
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
I'd find it helpful if you could say what specifically would have been useful.
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.
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
More examples are always welcome if anyone would like to submit PRs!