diff options
author | Marcos Amorim <mamorim@rkh.co.uk> | 2018-06-04 10:19:35 +0100 |
---|---|---|
committer | Marcos Amorim <mamorim@rkh.co.uk> | 2018-06-04 10:19:35 +0100 |
commit | b7d167c1f5ca480545262b8d844bf262791fbf7f (patch) | |
tree | ec6ec918d2337a933cae8986f16c34e325c8ad87 | |
parent | f0735cf81060925c76308db8abecab3c46482337 (diff) |
Ignore Single quotes throw ValueError
-rw-r--r-- | kubeshell/completer.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kubeshell/completer.py b/kubeshell/completer.py index 066cb0c..d710ce9 100644 --- a/kubeshell/completer.py +++ b/kubeshell/completer.py @@ -38,8 +38,11 @@ class KubectlCompleter(Completer): def get_completions(self, document, complete_event, smart_completion=None): word_before_cursor = document.get_word_before_cursor(WORD=True) cmdline = document.text_before_cursor.strip() - tokens = shlex.split(cmdline) - _, _, suggestions = self.parser.parse_tokens(tokens) - valid_keys = fuzzyfinder(word_before_cursor, suggestions.keys()) - for key in valid_keys: - yield Completion(key, -len(word_before_cursor), display=key, display_meta=suggestions[key]) + try: + tokens = shlex.split(cmdline) + _, _, suggestions = self.parser.parse_tokens(tokens) + valid_keys = fuzzyfinder(word_before_cursor, suggestions.keys()) + for key in valid_keys: + yield Completion(key, -len(word_before_cursor), display=key, display_meta=suggestions[key]) + except ValueError: + pass |