From 4e95310faedaab387bd1068411232cddcd3bb216 Mon Sep 17 00:00:00 2001 From: Greg Cockburn Date: Mon, 3 Oct 2016 01:41:55 +1100 Subject: 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 --- bin/jsondiff | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bin') 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() -- cgit v1.2.1