File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ def main():
30
30
group = parser .add_mutually_exclusive_group ()
31
31
group .add_argument ('--indent' , default = 4 , type = int ,
32
32
help = 'Indent level for pretty-printing.' )
33
- group .add_argument ('--no-indent' , action = 'store_true ' , default = False ,
34
- help = 'Use compact mode.' )
33
+ group .add_argument ('--no-indent' , action = 'store_const ' , dest = 'indent' ,
34
+ const = None , help = 'Use compact mode.' )
35
35
parser .add_argument ('--sort-keys' , action = 'store_true' , default = False ,
36
36
help = 'sort the output of dictionaries alphabetically by key' )
37
37
options = parser .parse_args ()
@@ -52,7 +52,7 @@ def main():
52
52
outfile = options .outfile or sys .stdout
53
53
with outfile :
54
54
json .dump (obj , outfile ,
55
- indent = None if options . no_indent else options .indent ,
55
+ indent = options .indent ,
56
56
ensure_ascii = not options .no_ensure_ascii ,
57
57
sort_keys = options .sort_keys ,
58
58
)
You can’t perform that action at this time.
0 commit comments