Skip to content

Commit 349ea11

Browse files
authored
Merge pull request #1148 from mathics/opt-e
Opt e
2 parents c4c64ea + 7f026ae commit 349ea11

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Mathics have been split off and moved to separately installable packages. In par
1212
* Specific builtins involving heavy, non-standard routines were moved to pymathics modules.
1313

1414

15+
Incompatible changes:
16+
+++++++++++++++++++++
17+
18+
* `-e` `--execute` is better suited for embedded use. It shows just evaluation output as text.
1519

1620

1721
New builtins

mathics/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ def read_line(self, prompt):
109109
return self.rl_read_line(prompt)
110110
return input(prompt)
111111

112-
def print_result(self, result):
112+
def print_result(self, result, no_out_prompt=False):
113113
if result is not None and result.result is not None:
114114
output = self.to_output(str(result.result))
115-
print(self.get_out_prompt() + output + "\n")
115+
mess = self.get_out_prompt() if not no_out_prompt else ""
116+
print(mess + output + "\n")
116117

117118
def rl_read_line(self, prompt):
118119
# Wrap ANSI colour sequences in \001 and \002, so readline
@@ -306,10 +307,9 @@ def main() -> int:
306307

307308
if args.execute:
308309
for expr in args.execute:
309-
print(shell.get_in_prompt() + expr)
310310
evaluation = Evaluation(shell.definitions, output=TerminalOutput(shell))
311311
result = evaluation.parse_evaluate(expr, timeout=settings.TIMEOUT)
312-
shell.print_result(result)
312+
shell.print_result(result, no_out_prompt=True)
313313
if evaluation.exc_result == Symbol("Null"):
314314
exit_rc = 0
315315
elif evaluation.exc_result == Symbol("$Aborted"):

mathics/version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#!/usr/bin/env python3
21
# -*- coding: utf-8 -*-
32

43

54
# This file is suitable for sourcing inside POSIX shell as
65
# well as importing into Python. That's why there is no
76
# space around "=" below.
8-
__version__="2.0.0.dev0" # noqa
7+
__version__="2.0.0.rc1" # noqa

0 commit comments

Comments
 (0)