File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ parser.add_argument('FILE1', type=argparse.FileType('r'))
1414parser .add_argument ('FILE2' , type = argparse .FileType ('r' ))
1515parser .add_argument ('--indent' , type = int , default = None ,
1616 help = 'Indent output by n spaces' )
17+ parser .add_argument ('-u' , '--preserve-unicode' , action = 'store_true' ,
18+ help = 'Output Unicode character as-is without using Code Point' )
1719parser .add_argument ('-v' , '--version' , action = 'version' ,
1820 version = '%(prog)s ' + jsonpatch .__version__ )
1921
@@ -32,7 +34,7 @@ def diff_files():
3234 doc2 = json .load (args .FILE2 )
3335 patch = jsonpatch .make_patch (doc1 , doc2 )
3436 if patch .patch :
35- print (json .dumps (patch .patch , indent = args .indent ))
37+ print (json .dumps (patch .patch , indent = args .indent , ensure_ascii = not ( args . preserve_unicode ) ))
3638 sys .exit (1 )
3739
3840if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ The JSON patch package contains the commandline utilities ``jsondiff`` and
1010The program ``jsondiff `` can be used to create a JSON patch by comparing two
1111JSON files ::
1212
13- usage: jsondiff [-h] [--indent INDENT] [-v] FILE1 FILE2
13+ usage: jsondiff [-h] [--indent INDENT] [-u] [- v] FILE1 FILE2
1414
1515 Diff two JSON files
1616
@@ -19,9 +19,10 @@ JSON files ::
1919 FILE2
2020
2121 optional arguments:
22- -h, --help show this help message and exit
23- --indent INDENT Indent output by n spaces
24- -v, --version show program's version number and exit
22+ -h, --help show this help message and exit
23+ --indent INDENT Indent output by n spaces
24+ -u, --preserve-unicode Output Unicode character as-is without using Code Point
25+ -v, --version show program's version number and exit
2526
2627Example
2728^^^^^^^
You can’t perform that action at this time.
0 commit comments