From b765ee50d31b1b629b7572c231d2cf2840a4146f Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Tue, 17 May 2022 11:24:49 +0200 Subject: utils: add print_json Adds a pretty printing function for JSON data. Replaces print for print_json in corresponding cli objects. Follows commit 828d6c0ce7d4a6b4bcd95e97155460fd59856bdd ("list scopes: pretty print scope tree") --- cli/objects/scopes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cli/objects/scopes.py') diff --git a/cli/objects/scopes.py b/cli/objects/scopes.py index 3517e43..5383932 100644 --- a/cli/objects/scopes.py +++ b/cli/objects/scopes.py @@ -5,12 +5,13 @@ # Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -import json +import argparse + +from cli.utils import print_json class OgScope(): @staticmethod def list_scopes(rest): r = rest.get('/scopes') - payload = json.loads(r.text) - print(json.dumps(payload, sort_keys=True, indent=2)) + print_json(r.text) -- cgit v1.2.3-18-g5258