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
This commit is contained in:
Greg Cockburn
2016-10-03 01:41:55 +11:00
committed by Stefan Kögl
parent 55e0c4372c
commit 4e95310fae

View File

@@ -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()