Mercurial > mozilla > hg > ProfileManager
diff profilemanager/command.py @ 4:35dc297efa25
adding listing function and other cleanup
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 05 Apr 2010 13:53:22 -0700 |
parents | 4d1cd60dd2a1 |
children | ca57920aa223 |
line wrap: on
line diff
--- a/profilemanager/command.py Mon Apr 05 13:10:31 2010 -0700 +++ b/profilemanager/command.py Mon Apr 05 13:53:22 2010 -0700 @@ -5,6 +5,7 @@ import inspect import sys from optparse import OptionParser +from pprint import pprint if 'commands' not in globals(): commands = {} @@ -95,7 +96,7 @@ class CommandParser(OptionParser): def __init__(self, commands, description=None, setup=None): usage = '%prog [options] command [command-options]' - OptionParser.__init__(self, description=description) + OptionParser.__init__(self, usage=usage, description=description) for _command in commands: command(_command) self.disable_interspersed_args() @@ -160,5 +161,5 @@ commandparser.error("Too many arguments given") # invoke the command - print getattr(_object, name)(*command_args, **command_options.__dict__) + pprint(getattr(_object, name)(*command_args, **command_options.__dict__))