From dd9717efb9cbbd2f791057742e6f7323b317d46b Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 13 Jul 2017 12:35:47 -0400 Subject: Added support for case-insensitive tab-completion of cmd2 command names --- cmd2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd2.py') 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): -- cgit v1.2.1