Message113616
argparse already seems to support -- to indicate that what follows are positional arguments. However, I would like to parse something like:
./script.py --ignore one two -- COMMAND
I.e., --ignore is an nargs='+' argument, and I need a way to break out of --ignore and have argparse consider what follows on it's own merits. If COMMAND in the above example refers to a subparser, this won't work:
error: invalid choice: '--' (choose from 'command1', 'command2', 'command3')
I'm not sure what's the best solution here. Allowing -- here would change the semantics of forcing everything that follows to be positional arguments, since the subparser might have flags. I'm not sure if that is what is required by Unix conventions, but if not, then I think it makes sense to allow -- to be followed by a subparser. |
|
Date |
User |
Action |
Args |
2010-08-11 19:21:27 | elsdoerfer | set | recipients:
+ elsdoerfer |
2010-08-11 19:21:27 | elsdoerfer | set | messageid: <1281554487.14.0.725527410465.issue9571@psf.upfronthosting.co.za> |
2010-08-11 19:21:25 | elsdoerfer | link | issue9571 messages |
2010-08-11 19:21:24 | elsdoerfer | create | |
|