scripts/qmp-shell: make QMPCompleter returns explicit

This function returns None when it doesn't find a match; do that
explicitly.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-13-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
John Snow 2021-06-07 16:06:19 -04:00
parent 50f6f1c308
commit 2813dee053

View File

@ -83,10 +83,10 @@ class QMPCompleter(list):
def complete(self, text, state):
for cmd in self:
if cmd.startswith(text):
if not state:
if state == 0:
return cmd
else:
state -= 1
state -= 1
return None
class QMPShellError(Exception):