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'))
14
14
parser .add_argument ('FILE2' , type = argparse .FileType ('r' ))
15
15
parser .add_argument ('--indent' , type = int , default = None ,
16
16
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' )
17
19
parser .add_argument ('-v' , '--version' , action = 'version' ,
18
20
version = '%(prog)s ' + jsonpatch .__version__ )
19
21
@@ -32,7 +34,7 @@ def diff_files():
32
34
doc2 = json .load (args .FILE2 )
33
35
patch = jsonpatch .make_patch (doc1 , doc2 )
34
36
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 ) ))
36
38
sys .exit (1 )
37
39
38
40
if __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
10
10
The program ``jsondiff `` can be used to create a JSON patch by comparing two
11
11
JSON files ::
12
12
13
- usage: jsondiff [-h] [--indent INDENT] [-v] FILE1 FILE2
13
+ usage: jsondiff [-h] [--indent INDENT] [-u] [- v] FILE1 FILE2
14
14
15
15
Diff two JSON files
16
16
@@ -19,9 +19,10 @@ JSON files ::
19
19
FILE2
20
20
21
21
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
25
26
26
27
Example
27
28
^^^^^^^
You can’t perform that action at this time.
0 commit comments