Mercurial > libervia-backend
diff libervia/cli/output_std.py @ 4326:5fd6a4dc2122
cli (output/std): use `rich` to output JSON.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 20 Nov 2024 11:38:44 +0100 |
parents | 0d7bb4df2343 |
children |
line wrap: on
line diff
--- a/libervia/cli/output_std.py Wed Nov 20 11:30:43 2024 +0100 +++ b/libervia/cli/output_std.py Wed Nov 20 11:38:44 2024 +0100 @@ -112,7 +112,7 @@ ) -class Json(object): +class Json: """outputs in json format""" def __init__(self, host): @@ -132,7 +132,7 @@ 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)