diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-27 23:03:35 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-27 23:03:35 -0400 |
commit | 554561b70f899ad8ec38393b27eed646456cab62 (patch) | |
tree | 197a5f86b09b0e176ff57831088c9e5cdb9a62f8 /examples/python_scripting.py | |
parent | 88ce0b509dc09233a7c3efca7f1bea8b2c6c1ae2 (diff) | |
download | cmd2-git-554561b70f899ad8ec38393b27eed646456cab62.tar.gz |
Addressed code review comments
Diffstat (limited to 'examples/python_scripting.py')
-rwxr-xr-x | examples/python_scripting.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/python_scripting.py b/examples/python_scripting.py index f4606251..5f7996e2 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -15,7 +15,6 @@ command and the "pyscript <script> [arguments]" syntax comes into play. This application and the "scripts/conditional.py" script serve as an example for one way in which this can be done. """ import argparse -import functools import os import cmd2 @@ -82,8 +81,9 @@ class CmdLineApp(cmd2.Cmd): self.perror(err, traceback_war=False) self._last_result = cmd2.CmdResult(out, err) - # Enable directory completion for cd command by freezing an argument to path_complete() with functools.partial - complete_cd = functools.partial(cmd2.path_complete, dir_only=True) + # Enable tab completion for cd command + def complete_cd(self, text, line, begidx, endidx): + return self.path_complete(text, line, begidx, endidx, dir_only=True) dir_parser = argparse.ArgumentParser() dir_parser.add_argument('-l', '--long', action='store_true', help="display in long format with one item per line") |