File tree Expand file tree Collapse file tree 4 files changed +5
-12
lines changed Expand file tree Collapse file tree 4 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -2569,15 +2569,6 @@ def run(filename):
2569
2569
except IOError as e :
2570
2570
self .perror (e )
2571
2571
2572
- # noinspection PyUnusedLocal
2573
- def onecmd_plus_hooks (cmd_plus_args ):
2574
- """Run a cmd2.Cmd command from a Python script or the interactive Python console.
2575
-
2576
- :param cmd_plus_args: str - command line including command and arguments to run
2577
- :return: bool - True if cmdloop() should exit once leaving the interactive Python console
2578
- """
2579
- return self .onecmd_plus_hooks (cmd_plus_args + '\n ' )
2580
-
2581
2572
bridge = PyscriptBridge (self )
2582
2573
self .pystate ['run' ] = run
2583
2574
self .pystate [self .pyscript_name ] = bridge
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ def __init__(self):
28
28
super ().__init__ (use_ipython = True )
29
29
self ._set_prompt ()
30
30
self .intro = 'Happy 𝛑 Day. Note the full Unicode support: 😇 (Python 3 only) 💩'
31
+ self .locals_in_py = True
31
32
32
33
def _set_prompt (self ):
33
34
"""Set prompt so it displays the current working directory."""
Original file line number Diff line number Diff line change 24
24
original_dir = os .getcwd ()
25
25
26
26
# Try to change to the specified directory
27
- cmd ('cd {}' .format (directory ))
27
+ app ('cd {}' .format (directory ))
28
28
29
29
# Conditionally do something based on the results of the last command
30
30
if self ._last_result :
31
31
print ('\n Contents of directory {!r}:' .format (directory ))
32
- cmd ('dir -l' )
32
+ app ('dir -l' )
33
33
34
34
# Change back to where we were
35
35
print ('Changing back to original directory: {!r}' .format (original_dir ))
36
- cmd ('cd {}' .format (original_dir ))
36
+ app ('cd {}' .format (original_dir ))
37
37
else :
38
38
# cd command failed, print a warning
39
39
print ('Failed to change directory to {!r}' .format (directory ))
Original file line number Diff line number Diff line change 8
8
# Set "use_ipython" to True to include the ipy command if IPython is installed, which supports advanced interactive
9
9
# debugging of your application via introspection on self.
10
10
app = cmd2 .Cmd (use_ipython = True )
11
+ app .locals_in_py = True
11
12
app .cmdloop ()
You can’t perform that action at this time.
0 commit comments