From 828d6c0ce7d4a6b4bcd95e97155460fd59856bdd Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Mon, 16 May 2022 09:07:03 +0200 Subject: list scopes: pretty print scope tree Use json module to pretty print the scope tree. JSON keys are ordered and two-space indentation is used. --- cli/objects/scopes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/objects/scopes.py b/cli/objects/scopes.py index 4b8fa95..3517e43 100644 --- a/cli/objects/scopes.py +++ b/cli/objects/scopes.py @@ -5,9 +5,12 @@ # Free Software Foundation; either version 3 of the License, or # (at your option) any later version. +import json + class OgScope(): @staticmethod def list_scopes(rest): r = rest.get('/scopes') - print(r.text) + payload = json.loads(r.text) + print(json.dumps(payload, sort_keys=True, indent=2)) -- cgit v1.2.3-18-g5258