mirror of
https://github.com/borgbackup/borg.git
synced 2026-07-15 21:12:50 -04:00
json: support BORG_JSON_COMPACT env var for single-line output
This commit is contained in:
parent
8d715e030b
commit
4c380d3aff
1 changed files with 4 additions and 1 deletions
|
|
@ -1041,7 +1041,10 @@ def basic_json_data(manifest, *, cache=None, extra=None):
|
|||
|
||||
def json_dump(obj):
|
||||
"""Dump using BorgJSONEncoder."""
|
||||
return json.dumps(obj, sort_keys=True, indent=4, cls=BorgJsonEncoder)
|
||||
indent = 4
|
||||
if os.environ.get("BORG_JSON_COMPACT"):
|
||||
indent = None
|
||||
return json.dumps(obj, sort_keys=True, indent=indent, cls=BorgJsonEncoder)
|
||||
|
||||
|
||||
def json_print(obj):
|
||||
|
|
|
|||
Loading…
Reference in a new issue