summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-23 01:17:07 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-03-23 01:17:07 -0400
commit51da5c87757e0e4b4685f0c8b839da7c66b0eaa2 (patch)
tree1ce0575ecf9020e1f413574572ac6eae19add2b3 /cmd2.py
parent4f21fe86085040407cc4410e3425dcd40f7a6e4a (diff)
downloadcmd2-git-51da5c87757e0e4b4685f0c8b839da7c66b0eaa2.tar.gz
Added an extra parsing check
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index 3781f666..5193f09f 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1887,6 +1887,13 @@ class Cmd(cmd.Cmd):
# Get all tokens through the one being completed
tokens = tokens_for_completion(line, begidx, endidx, preserve_quotes=True)
+ # Either had a parsing error or are trying to complete the command token
+ # The latter can happen if default_to_shell is True and parseline() allowed
+ # assumed something like " or ' was a command.
+ if tokens is None or len(tokens) == 1:
+ self.completion_matches = []
+ return None
+
# Get the status of quotes in the token being completed
completion_token = tokens[-1]