diff options
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/python_scripting.py | 1 | ||||
-rw-r--r-- | examples/scripts/conditional.py | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/examples/python_scripting.py b/examples/python_scripting.py index 7e2cf345..fd2d7e8f 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -28,6 +28,7 @@ class CmdLineApp(cmd2.Cmd): super().__init__(use_ipython=True) self._set_prompt() self.intro = 'Happy 𝛑 Day. Note the full Unicode support: 😇 (Python 3 only) 💩' + self.locals_in_py = True def _set_prompt(self): """Set prompt so it displays the current working directory.""" diff --git a/examples/scripts/conditional.py b/examples/scripts/conditional.py index 1eeeadba..87cd10ac 100644 --- a/examples/scripts/conditional.py +++ b/examples/scripts/conditional.py @@ -24,16 +24,16 @@ else: original_dir = os.getcwd() # Try to change to the specified directory -cmd('cd {}'.format(directory)) +app('cd {}'.format(directory)) # Conditionally do something based on the results of the last command if self._last_result: print('\nContents of directory {!r}:'.format(directory)) - cmd('dir -l') + app('dir -l') # Change back to where we were print('Changing back to original directory: {!r}'.format(original_dir)) - cmd('cd {}'.format(original_dir)) + app('cd {}'.format(original_dir)) else: # cd command failed, print a warning print('Failed to change directory to {!r}'.format(directory)) |