summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Cockburn <gergnz@gmail.com>2016-10-03 01:41:55 +1100
committerStefan Kögl <stefan@skoegl.net>2016-10-02 16:41:55 +0200
commit4e95310faedaab387bd1068411232cddcd3bb216 (patch)
tree2d9add25286bb783ec8f5ea479d6a038c2671516
parent55e0c4372cfb84b2227e0544d8beebe3102a5658 (diff)
downloadpython-json-patch-4e95310faedaab387bd1068411232cddcd3bb216.tar.gz
If there is no diff print nothing; exit 1 if a diff is found (#53)
if there is no diff print nothing, and exit 1 if a diff is found
-rwxr-xr-xbin/jsondiff5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/jsondiff b/bin/jsondiff
index 81c83a7..54b4a61 100755
--- a/bin/jsondiff
+++ b/bin/jsondiff
@@ -32,8 +32,9 @@ def diff_files():
doc1 = json.load(args.FILE1)
doc2 = json.load(args.FILE2)
patch = jsonpatch.make_patch(doc1, doc2)
- print(json.dumps(patch.patch, indent=args.indent))
-
+ if patch.patch:
+ print(json.dumps(patch.patch, indent=args.indent))
+ sys.exit(1)
if __name__ == "__main__":
main()