OptionParser How to: prog <cmd> [options] [arguments]

Javier Collado javier.collado at gmail.com
Fri Aug 14 03:18:45 EDT 2009


Hello,

I think that this isn't possible with optparse library.

However, it's possible with argparse (http://code.google.com/p/argparse/):
 http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#sub-commands

It's not a standard library, but it's worth to take a look at it.

Best regards,
    Javier

2009/8/14 Steven Woody <narkewoody at gmail.com>:
> Hi,
> I am using OptionParser, but I've not managed figure out a way to support
> what I wanted command line format "prog <cmd> [options] [arguments]".
> E.g., "svn ls -r123 http://hello.world".   Can I do this using OptionParser?
> Thanks.
> --
> Life is the only flaw in an otherwise perfect nonexistence
>    -- Schopenhauer
>
> narke
> public key at http://subkeys.pgp.net:11371 (narkewoody at gmail.com)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>



More information about the Python-list mailing list