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):
25692569 except IOError as e :
25702570 self .perror (e )
25712571
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-
25812572 bridge = PyscriptBridge (self )
25822573 self .pystate ['run' ] = run
25832574 self .pystate [self .pyscript_name ] = bridge
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ def __init__(self):
2828 super ().__init__ (use_ipython = True )
2929 self ._set_prompt ()
3030 self .intro = 'Happy 𝛑 Day. Note the full Unicode support: 😇 (Python 3 only) 💩'
31+ self .locals_in_py = True
3132
3233 def _set_prompt (self ):
3334 """Set prompt so it displays the current working directory."""
Original file line number Diff line number Diff line change 2424original_dir = os .getcwd ()
2525
2626# Try to change to the specified directory
27- cmd ('cd {}' .format (directory ))
27+ app ('cd {}' .format (directory ))
2828
2929# Conditionally do something based on the results of the last command
3030if self ._last_result :
3131 print ('\n Contents of directory {!r}:' .format (directory ))
32- cmd ('dir -l' )
32+ app ('dir -l' )
3333
3434 # Change back to where we were
3535 print ('Changing back to original directory: {!r}' .format (original_dir ))
36- cmd ('cd {}' .format (original_dir ))
36+ app ('cd {}' .format (original_dir ))
3737else :
3838 # cd command failed, print a warning
3939 print ('Failed to change directory to {!r}' .format (directory ))
Original file line number Diff line number Diff line change 88 # Set "use_ipython" to True to include the ipy command if IPython is installed, which supports advanced interactive
99 # debugging of your application via introspection on self.
1010 app = cmd2 .Cmd (use_ipython = True )
11+ app .locals_in_py = True
1112 app .cmdloop ()
You can’t perform that action at this time.
0 commit comments