@@ -54,7 +54,7 @@ def get_options(argv: Optional[list[str]] = None) -> argparse.ArgumentParser:
54
54
)
55
55
parser .add_argument (
56
56
"-o" , "--output" , metavar = "<arg>" ,
57
- help = "JSON output file (- for stdin )"
57
+ help = "JSON output file (default=stdout )"
58
58
)
59
59
parser .add_argument (
60
60
"-oc" , "--ocharset" , default = "utf-8" , metavar = "<arg>" ,
@@ -78,7 +78,7 @@ def get_options(argv: Optional[list[str]] = None) -> argparse.ArgumentParser:
78
78
)
79
79
parser .add_argument (
80
80
"-it" , "--interactive" , default = False , action = "store_true" ,
81
- help = "Interactive REPL"
81
+ help = "Interactive REPL (requires input file) "
82
82
)
83
83
84
84
# The expression
@@ -160,8 +160,9 @@ def main(argv: Optional[list[str]] = None) -> int:
160
160
options = parser .parse_args (argv )
161
161
162
162
if options .expression is None and options .expr is None :
163
- parser .print_help ()
164
- return 1
163
+ if not options .interactive :
164
+ parser .print_help ()
165
+ return 1
165
166
166
167
icharset = options .icharset
167
168
ocharset = options .icharset
@@ -187,6 +188,9 @@ def main(argv: Optional[list[str]] = None) -> int:
187
188
bindings = json .loads (bindings_str )
188
189
189
190
if options .input == '-' or options .input is None :
191
+ if options .interactive :
192
+ parser .print_help ()
193
+ return 1
190
194
input = sys .stdin .read ()
191
195
else :
192
196
with open (options .input , 'r' , encoding = icharset ) as fd :
0 commit comments