diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-19 22:00:31 -0400 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-19 22:00:31 -0400 |
| commit | 0c367e19d71e78a1e60c87c69df8bfb91192d045 (patch) | |
| tree | b28e48322fb707f5893a2af72ba3b0abd0d6cf04 /cmd2.py | |
| parent | 42fbd780d2393f4a2a6e25909a0a6f3f40b596a4 (diff) | |
| download | cmd2-git-0c367e19d71e78a1e60c87c69df8bfb91192d045.tar.gz | |
Appending closing quote and space when needed
Diffstat (limited to 'cmd2.py')
| -rw-r--r-- | cmd2.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1531,6 +1531,20 @@ class Cmd(cmd.Cmd): # Call the completer function self.completion_matches = compfunc(text, line, begidx, endidx) + # Handle single result + if len(self.completion_matches) == 1: + str_to_append = '' + + # Add a closing quote if needed + if allow_closing_quote and unclosed_quote: + str_to_append += unclosed_quote + + # If we are at the end of the line, then add a space + if allow_appended_space and endidx == len(line): + str_to_append += ' ' + + self.completion_matches[0] = self.completion_matches[0] + str_to_append + else: # Complete the command against aliases and command names strs_to_match = list(self.aliases.keys()) |
