From: Brian Warner Date: Tue, 18 Nov 2008 05:02:19 +0000 (-0700) Subject: cli: add --verbose to 'tahoe manifest', to show the raw JSON data X-Git-Tag: allmydata-tahoe-1.3.0~419 X-Git-Url: https://git.rkrishnan.org/module-simplejson.tests.html?a=commitdiff_plain;h=94de73ddc0c65fed50b53c1f06d762e525768f11;p=tahoe-lafs%2Ftahoe-lafs.git cli: add --verbose to 'tahoe manifest', to show the raw JSON data --- diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index ee3395b1..e9f80771 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -210,6 +210,9 @@ class ManifestOptions(VDriveOptions): longdesc = """Print a list of all files/directories reachable from the given starting point.""" class StatsOptions(VDriveOptions): + optFlags = [ + ("verbose", "v", "Display raw JSON data instead of parsed"), + ] def parseArgs(self, where=''): self.where = where diff --git a/src/allmydata/scripts/tahoe_manifest.py b/src/allmydata/scripts/tahoe_manifest.py index 7772a80d..378ad369 100644 --- a/src/allmydata/scripts/tahoe_manifest.py +++ b/src/allmydata/scripts/tahoe_manifest.py @@ -63,9 +63,13 @@ class SlowOperationRunner: if resp.status != 200: print >>stderr, "ERROR", resp.status, resp.reason, resp.read() return True - data = simplejson.loads(resp.read()) + jdata = resp.read() + data = simplejson.loads(jdata) if not data["finished"]: return False + if self.options.get("verbose"): + print jdata + return True self.write_results(data) return True