On Tue, 16 Nov 2010, Neal Becker wrote:
> I want to have subparsers, but I also want to be able to say:
> 
> myprogram --version
> and get the version #
> 
> ---------------------------

[...]

AFAIK, it is not possible ATM to have optional subparsers with argparse:

http://code.google.com/p/argparse/issues/detail?id=47

To do something like what you want, I've done my own pre-parsing of the 
command-line to separate out sub-options, and then sent them to multiple 
separate top-level ArgumentParser instances. 

Regards,

john
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to