Skip to content

Commit 60bf3aa

Browse files
committed
Returned cmd_echo default to False except when running a Python command at the CLI
1 parent c347ac8 commit 60bf3aa

20 files changed

+21
-1
lines changed

cmd2/cmd2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,6 +2989,8 @@ def run(filename: str):
29892989
if args.remainder:
29902990
full_command += ' ' + ' '.join(args.remainder)
29912991

2992+
# If running at the CLI, print the output of the command
2993+
bridge.cmd_echo = True
29922994
interp.runcode(full_command)
29932995

29942996
# If there are no args, then we will open an interactive Python console

cmd2/pyscript_bridge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class PyscriptBridge(object):
247247
def __init__(self, cmd2_app):
248248
self._cmd2_app = cmd2_app
249249
self._last_result = None
250-
self.cmd_echo = True
250+
self.cmd_echo = False
251251

252252
def __getattr__(self, item: str):
253253
"""

tests/pyscript/bar1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
app.cmd_echo = True
12
app.bar('11', '22')

tests/pyscript/custom_echo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
custom.cmd_echo = True
12
custom.echo('blah!')

tests/pyscript/foo1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
app.cmd_echo = True
12
app.foo('aaa', 'bbb', counter=3, trueval=True, constval=True)

tests/pyscript/foo2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
app.cmd_echo = True
12
app.foo('11', '22', '33', '44', counter=3, trueval=True, constval=True)

tests/pyscript/foo3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
app.cmd_echo = True
12
app.foo('11', '22', '33', '44', '55', '66', counter=3, trueval=False, constval=False)

tests/pyscript/foo4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
app.cmd_echo = True
12
result = app.foo('aaa', 'bbb', counter=3)
23
out_text = 'Fail'
34
if result:

tests/pyscript/help.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
app.cmd_echo = True
12
app.help()

tests/pyscript/help_media.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
app.cmd_echo = True
12
app.help('media')

0 commit comments

Comments
 (0)