summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-27 23:03:35 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-27 23:03:35 -0400
commit554561b70f899ad8ec38393b27eed646456cab62 (patch)
tree197a5f86b09b0e176ff57831088c9e5cdb9a62f8 /examples
parent88ce0b509dc09233a7c3efca7f1bea8b2c6c1ae2 (diff)
downloadcmd2-git-554561b70f899ad8ec38393b27eed646456cab62.tar.gz
Addressed code review comments
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/paged_output.py3
-rwxr-xr-xexamples/python_scripting.py6
2 files changed, 4 insertions, 5 deletions
diff --git a/examples/paged_output.py b/examples/paged_output.py
index 9005a4da..cb213087 100755
--- a/examples/paged_output.py
+++ b/examples/paged_output.py
@@ -2,7 +2,6 @@
# coding=utf-8
"""A simple example demonstrating the using paged output via the ppaged() method.
"""
-import functools
import cmd2
from cmd2 import with_argument_list
@@ -25,7 +24,7 @@ class PagedOutput(cmd2.Cmd):
text = f.read()
self.ppaged(text)
- complete_page_file = functools.partial(cmd2.path_complete)
+ complete_page_file = cmd2.Cmd.path_complete
if __name__ == '__main__':
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")