> You can probably do something similar using sub commands > (http://docs.python.org/2/library/argparse.html#sub-commands).
The problem here is that argparse does not pass the subparser into the parsed args and shared args between subparsers need to be declared each time. Come execution time, when you have shared args you end up testing for various incantations of the invoked code, you're better off omitting subparsers and performing conditional tests after parsing for incompatible combinations. It's a waste of typing to write out a mode followed by params to achieve the ops goal, I've hit the same limitation. Certainly a weakness of argparse in my opinion. It's also a tough sell to force a user to install a package just for the cli if you go with docopt. I'd love to see argparse expand or docopt get included... jlc -- http://mail.python.org/mailman/listinfo/python-list