mpeterv / argparse

Feature-rich command line parser for Lua
MIT License
251 stars 43 forks source link

Add handle_options property to Parser #2

Closed Alloyed closed 9 years ago

Alloyed commented 9 years ago

When parser:handle_options(true) (the default), the parser will behave as before.

When parser:handle_options(false), all options will be passed verbatim to the argument list, as if the input included double-hyphens.

Use case: I am writing a wrapper over an existing CLI tool, and I'd like to include a "passthrough" command so that any options, arguments etc. are applied directly to that tool instead of being consumed by argparse. All the other commands are handled by argparse normally.

Also, I couldn't tell if the tutorial docs were generated by a tool or not. Could you please document this change with whatever workflow you have set up?

mpeterv commented 9 years ago

Thanks! I think a similar use case exists for options - specifying arguments for another command using an option, e.g. --args, is a little more verbose but allows to use other options, like --help, before or instead of --args. I'll see if I can implement that.

The tutorial used to be generated from a markdown file but it was lost. I plan to convert it to .rst and move it to readthedocs.org and will document this change in the process. Although I won't be able to make a release till the weekend, unfortunately.

mpeterv commented 9 years ago

0.4.0 released with this change.