This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A simple addition to Python's optparse module supporting subcommands | |
like those found in the svn or hg CLIs. | |
To use it, instantiate the Subcommand class for every subcommand you | |
want to support. Each subcommand has a name, aliases, a help message, | |
and a separate OptionParser instance. Then pass a list of Subcommands | |
to the constructor of SubcommandsOptionParser to make a subcommand- | |
aware parser. Calling parse_args on that parser gives you the | |
subcommand invoked, the subcommand's arguments and options, and the | |
global options all in one fell swoop. See the smoke test at the bottom |