# HG changeset patch # User Jeff Hammel # Date 1327702203 28800 # Node ID d5e88dadde69d5e15a5b501ba2a16a0eea331606 # Parent 85357b0752112db4ffd34a2f7683300936b087a8 add a bug command thingy diff -r 85357b075211 -r d5e88dadde69 bzconsole/api.py --- a/bzconsole/api.py Fri Oct 14 12:10:10 2011 -0700 +++ b/bzconsole/api.py Fri Jan 27 14:10:03 2012 -0800 @@ -73,6 +73,11 @@ assert self.username and self.password, "Must be authenticated" return self._request('/user?match=%s' % match) + def bug(self, number): + """display a bug""" + number = int(number) + return self._request('/bug/%d' % number) + def new(self, component, title, product=None, version=None, description=None, whiteboard=(), cc=()): """file a new bug. username and password must be set""" @@ -118,7 +123,7 @@ description = tmpbuffer() assert description, "Must provide a non-empty description" request['comments'] = [self._comment(description)] - + # add whiteboard, if given if whiteboard: if isinstance(whiteboard, basestring): @@ -137,7 +142,7 @@ def configuration(self): """bugzilla configuration""" - + if not hasattr(self, '_configuration'): config_cache = os.path.join(os.environ['HOME'], self.config_cache) if not self.refresh: diff -r 85357b075211 -r d5e88dadde69 bzconsole/command.py --- a/bzconsole/command.py Fri Oct 14 12:10:10 2011 -0700 +++ b/bzconsole/command.py Fri Jan 27 14:10:03 2012 -0800 @@ -12,7 +12,7 @@ class Undefined(object): def __init__(self, default): self.default=default - + class CommandParser(OptionParser): # TODO: add `help` command @@ -33,7 +33,7 @@ # get class options init = self.command(_class.__init__) self.command2parser(init, self) - + self.disable_interspersed_args() def add_option(self, *args, **kwargs): @@ -136,7 +136,7 @@ print i elif isinstance(retval, dict): try: - print json.dumps(retval) + print json.dumps(retval, indent=2, sort_keys=True) except: pprint(retval) else: @@ -159,7 +159,7 @@ optional = None command = { 'doc': doc, 'name': name, - 'args': args, + 'args': args, 'optional': optional, 'varargs': argspec.varargs } diff -r 85357b075211 -r d5e88dadde69 setup.py --- a/setup.py Fri Oct 14 12:10:10 2011 -0700 +++ b/setup.py Fri Jan 27 14:10:03 2012 -0800 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.2' +version = '0.2.1' readme = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.txt')