diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-05-17 11:24:49 +0200 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-05-17 11:24:49 +0200 |
commit | b765ee50d31b1b629b7572c231d2cf2840a4146f (patch) | |
tree | 33d9b0826450d1f05fa78f1dce5041ee38bf2676 /cli/objects/client.py | |
parent | d8efd3321c759440c1f9f66b55b6b2c8b1edb67a (diff) |
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")
Diffstat (limited to 'cli/objects/client.py')
-rw-r--r-- | cli/objects/client.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/objects/client.py b/cli/objects/client.py index bd84dd8..c250470 100644 --- a/cli/objects/client.py +++ b/cli/objects/client.py @@ -7,12 +7,14 @@ import argparse +from cli.utils import print_json + class OgClient(): @staticmethod def list_clients(rest): r = rest.get('/clients') - print(r.text) + print_json(r.text) @staticmethod def list_client_hardware(rest, args): @@ -26,7 +28,7 @@ class OgClient(): payload = {'client': parsed_args.client_ip} r = rest.get('/hardware', payload=payload) - print(r.text) + print_json(r.text) @staticmethod def get_client_properties(rest, args): @@ -39,4 +41,4 @@ class OgClient(): payload = {'client': parsed_args.client_ip} r = rest.get('/client/info', payload=payload) - print(r.text) + print_json(r.text) |