Skip to content
Snippets Groups Projects
Commit 443e2baf authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Don't pretty-print the JSON output by default as it will usually be so...

Don't pretty-print the JSON output by default as it will usually be so complicated to be unreadable by the human eye and it can be easily replaced by piping to "| jq".
parent e799eff4
No related branches found
No related tags found
No related merge requests found
Pipeline #135629 passed
......@@ -2,7 +2,7 @@
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2017, 2019 Chris Lamb <lamby@debian.org>
# Copyright © 2017, 2019-2020 Chris Lamb <lamby@debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -40,7 +40,7 @@ class JSONPresenter(Presenter):
root[0][JSON_FORMAT_MAGIC] = JSON_FORMAT_VERSION
root[0].move_to_end(JSON_FORMAT_MAGIC, last=False)
self.print_func(json.dumps(root[0], indent=2))
self.print_func(json.dumps(root[0]))
def visit_difference(self, difference):
while self.depth + 1 < len(self.stack):
......
{
"diffoscope-json-version": 1,
"source1": "test1.tar",
"source2": "test2.tar",
"unified_diff": null,
"details": [
{
"source1": "file list",
"source2": "file list",
"unified_diff": "@@ -1,4 +1,4 @@\n-drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/\n--rw-r--r-- 0 lunar (1000) lunar (1000) 446 2015-06-29 15:49:09.000000 dir/text\n-crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:09.000000 dir/null\n-lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/link -> broken\n+drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/\n+-rw-r--r-- 0 lunar (1000) lunar (1000) 671 2015-06-29 15:49:41.000000 dir/text\n+crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:41.000000 dir/null\n+lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/link -> really-broken\n"
},
{
"source1": "dir/text",
"source2": "dir/text",
"unified_diff": "@@ -1,6 +1,12 @@\n+A common form of lorem ipsum reads:\n+\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor\n incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\n nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu\n fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in\n culpa qui officia deserunt mollit anim id est laborum.\n+\n+\"Lorem ipsum\" text is derived from sections 1.10.32--3 of Cicero's De finibus\n+bonorum et malorum (On the Ends of Goods and Evils, or alternatively [About]\n+The Purposes of Good and Evil).\n"
},
{
"source1": "dir/link",
"source2": "dir/link",
"comments": [
"symlink"
],
"unified_diff": "@@ -1 +1 @@\n-destination: broken\n+destination: really-broken\n"
}
]
}
{"diffoscope-json-version": 1, "source1": "test1.tar", "source2": "test2.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,4 +1,4 @@\n-drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/\n--rw-r--r-- 0 lunar (1000) lunar (1000) 446 2015-06-29 15:49:09.000000 dir/text\n-crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:09.000000 dir/null\n-lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/link -> broken\n+drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/\n+-rw-r--r-- 0 lunar (1000) lunar (1000) 671 2015-06-29 15:49:41.000000 dir/text\n+crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:41.000000 dir/null\n+lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/link -> really-broken\n"}, {"source1": "dir/text", "source2": "dir/text", "unified_diff": "@@ -1,6 +1,12 @@\n+A common form of lorem ipsum reads:\n+\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor\n incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\n nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu\n fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in\n culpa qui officia deserunt mollit anim id est laborum.\n+\n+\"Lorem ipsum\" text is derived from sections 1.10.32--3 of Cicero's De finibus\n+bonorum et malorum (On the Ends of Goods and Evils, or alternatively [About]\n+The Purposes of Good and Evil).\n"}, {"source1": "dir/link", "source2": "dir/link", "comments": ["symlink"], "unified_diff": "@@ -1 +1 @@\n-destination: broken\n+destination: really-broken\n"}]}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment