diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-13 12:35:47 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-13 12:35:47 -0400 |
commit | dd9717efb9cbbd2f791057742e6f7323b317d46b (patch) | |
tree | 1262c76878a5202366fe284b734e5657723ac3cd /cmd2.py | |
parent | 30a3b66e8bc9f2fc65f5ff763841438ecda3a362 (diff) | |
download | cmd2-git-dd9717efb9cbbd2f791057742e6f7323b317d46b.tar.gz |
Added support for case-insensitive tab-completion of cmd2 command names
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -582,8 +582,12 @@ class Cmd(cmd.Cmd): # noinspection PyMethodOverriding def completenames(self, text, line, begidx, endidx): """Override of cmd2 method which completes command names both for command completion and help.""" + command = text + if self.case_insensitive: + command = text.lower() + # Call super class method. Need to do it this way for Python 2 and 3 compatibility - cmd_completion = cmd.Cmd.completenames(self, text) + cmd_completion = cmd.Cmd.completenames(self, command) # If we are completing the initial command name and get exactly 1 result and are at end of line, add a space if begidx == 0 and len(cmd_completion) == 1 and endidx == len(line): |