cli (output/std): use rich to output JSON.
This commit is contained in:
parent
8443ddac65
commit
0c27fef2ac
1 changed files with 3 additions and 3 deletions
|
|
@ -112,7 +112,7 @@ class Simple(object):
|
|||
)
|
||||
|
||||
|
||||
class Json(object):
|
||||
class Json:
|
||||
"""outputs in json format"""
|
||||
|
||||
def __init__(self, host):
|
||||
|
|
@ -132,7 +132,7 @@ class Json(object):
|
|||
host.register_output(C.OUTPUT_COMPLEX, C.OUTPUT_NAME_JSON_RAW, self.dump)
|
||||
|
||||
def dump(self, data):
|
||||
self.host.disp(json.dumps(data, default=str))
|
||||
self.host.console.print_json(data=data, indent=None, highlight=False, default=str)
|
||||
|
||||
def dump_pretty(self, data):
|
||||
self.host.disp(json.dumps(data, indent=4, default=str))
|
||||
self.host.console.print_json(data=data, indent=4, default=str)
|
||||
|
|
|
|||
Loading…
Reference in a new issue