[Patchew-devel] [PATCH] patchew-cli: print well-formed JSON in "patchew-cli project --raw"

Paolo Bonzini pbonzini at redhat.com
Tue Mar 20 17:45:01 UTC 2018


"print(r)" use single quotes for dictionary keys.  Using json.dumps
makes sure that we produce valid JSON, and that is useful from tests.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
	I have not yet posted the test that uses this trivial change,
	but it is pretty obvious so I'm pushing it.

 patchew-cli | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/patchew-cli b/patchew-cli
index 51a89c5..5369ae3 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -223,7 +223,7 @@ class ProjectCommand(SubCommand):
         args = parser.parse_args(argv)
         r = self.api_do("get-projects")
         if args.raw:
-            print(r)
+            print(json.dumps(r, indent=2, separators=",:"))
             return 0
         for p in r:
             print(p["name"])
-- 
2.16.2




More information about the Patchew-devel mailing list