summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-13 12:35:47 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-07-13 12:35:47 -0400
commitdd9717efb9cbbd2f791057742e6f7323b317d46b (patch)
tree1262c76878a5202366fe284b734e5657723ac3cd /cmd2.py
parent30a3b66e8bc9f2fc65f5ff763841438ecda3a362 (diff)
downloadcmd2-git-dd9717efb9cbbd2f791057742e6f7323b317d46b.tar.gz
Added support for case-insensitive tab-completion of cmd2 command names
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd2.py b/cmd2.py
index f76072fe..4b4bc458 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -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):