jsonata-python 0.5.2__py3-none-any.whl → 0.5.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
jsonata/cli/__main__.py CHANGED
@@ -34,7 +34,7 @@ def get_options(argv: Optional[list[str]] = None) -> argparse.ArgumentParser:
34
34
  """
35
35
  parser = argparse.ArgumentParser(prog="jsonata.cli", description="Pure Python JSONata CLI")
36
36
  parser.add_argument(
37
- "-v", "--version", action='version', version='%(prog)s 0.5.2')
37
+ "-v", "--version", action='version', version='%(prog)s 0.5.3')
38
38
 
39
39
  parser.add_argument(
40
40
  "-e", "--expression", metavar="<file>",
@@ -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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jsonata-python
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: Pure Python implementation of JSONata
5
5
  Project-URL: Homepage, https://github.com/rayokota/jsonata-python
6
6
  Project-URL: Bug Reports, https://github.com/rayokota/jsonata-python/issues
@@ -278,7 +278,7 @@ options:
278
278
  -f {auto,json,string}, --format {auto,json,string}
279
279
  Input format (default=auto)
280
280
  -o <arg>, --output <arg>
281
- JSON output file (- for stdin)
281
+ JSON output file (default=stdout)
282
282
  -oc <arg>, --ocharset <arg>
283
283
  Output character set (default=utf-8)
284
284
  -time Print performance timers to stderr
@@ -287,7 +287,7 @@ options:
287
287
  JSONata variable bindings
288
288
  -bf <file>, --bindings-file <file>
289
289
  JSONata variable bindings file
290
- -it, --interactive Interactive REPL
290
+ -it, --interactive Interactive REPL (requires input file)
291
291
  ```
292
292
 
293
293
  ### Examples
@@ -317,6 +317,11 @@ helloworld.json
317
317
  "frederic.smith@very-serious.com"
318
318
  ]
319
319
  }
320
+
321
+ % python3 -m jsonata.cli -i helloworld.json -it
322
+ Enter an expression to have it evaluated.
323
+ JSONata> (a & b)
324
+ hello world
320
325
  ```
321
326
 
322
327
  ## Running Tests
@@ -10,8 +10,8 @@ jsonata/timebox.py,sha256=bnevNR_ONvKUiIZCJZEWsRiR0gCWTGOwn5RCY7dKqYc,2861
10
10
  jsonata/tokenizer.py,sha256=X-JsARtkBIN6bO8_TElpw3SCageQMtfBWlexuhG2Sds,11982
11
11
  jsonata/utils.py,sha256=U13I49Ie3hEn3PKGR4361TPengDAkbyHmwipDFZJlXo,5192
12
12
  jsonata/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- jsonata/cli/__main__.py,sha256=MMJkVvYUzbWMG5_I142RINTmQntgL17LQKNs1iv1pn4,6971
14
- jsonata_python-0.5.2.dist-info/METADATA,sha256=Oozc2sFoZzLB2IKV33eI9omuQJtsqln4UmjgtnzvxGU,17297
15
- jsonata_python-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- jsonata_python-0.5.2.dist-info/licenses/LICENSE,sha256=y16Ofl9KOYjhBjwULGDcLfdWBfTEZRXnduOspt-XbhQ,11325
17
- jsonata_python-0.5.2.dist-info/RECORD,,
13
+ jsonata/cli/__main__.py,sha256=d_tNQ3Y_yN9o_NzBip8LdhsAVLAAA62GeowFKc6zx3Y,7125
14
+ jsonata_python-0.5.3.dist-info/METADATA,sha256=_qkeeFX_iFWyljejtPGrx3Xjt8mgkX0tKIkTk_-uNlc,17442
15
+ jsonata_python-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ jsonata_python-0.5.3.dist-info/licenses/LICENSE,sha256=y16Ofl9KOYjhBjwULGDcLfdWBfTEZRXnduOspt-XbhQ,11325
17
+ jsonata_python-0.5.3.dist-info/RECORD,,