cli: add --verbose to 'tahoe manifest', to show the raw JSON data
authorBrian Warner <warner@allmydata.com>
Tue, 18 Nov 2008 05:02:19 +0000 (22:02 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 18 Nov 2008 05:02:19 +0000 (22:02 -0700)
src/allmydata/scripts/cli.py
src/allmydata/scripts/tahoe_manifest.py

index ee3395b1409a9ca89aff01b8e61f7fd3ae451eab..e9f8077110a1a6cbf5352a18eaff32422e3a2d2e 100644 (file)
@@ -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
 
index 7772a80def352da2c45be35f5d04e22112ce8767..378ad36947be0b65c7297ee0f1983299642ea259 100644 (file)
@@ -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