Server IP : 162.241.126.129 / Your IP : 18.118.164.100 Web Server : Apache System : Linux 162-241-126-129.cprapid.com 4.18.0-477.27.2.el8_8.x86_64 #1 SMP Fri Sep 29 08:21:01 EDT 2023 x86_64 User : rvway5nu4 ( 1018) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /bin/ |
Upload File : |
#!/usr/libexec/platform-python -s # -*- coding: utf-8 -*- from __future__ import print_function import sys import os.path import json import jsonpatch import argparse parser = argparse.ArgumentParser(description='Diff two JSON files') parser.add_argument('FILE1', type=argparse.FileType('r')) parser.add_argument('FILE2', type=argparse.FileType('r')) parser.add_argument('--indent', type=int, default=None, help='Indent output by n spaces') parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + jsonpatch.__version__) def main(): try: diff_files() except KeyboardInterrupt: sys.exit(1) def diff_files(): """ Diffs two JSON files and prints a patch """ args = parser.parse_args() doc1 = json.load(args.FILE1) doc2 = json.load(args.FILE2) patch = jsonpatch.make_patch(doc1, doc2) if patch.patch: print(json.dumps(patch.patch, indent=args.indent)) sys.exit(1) if __name__ == "__main__": main()