summary refs log tree commit diff stats
path: root/scripts/qmp/qmp-shell
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-06-07 16:06:19 -0400
committerJohn Snow <jsnow@redhat.com>2021-06-18 16:10:06 -0400
commit2813dee0536c1b5d114c0fa0bdeb25317a38f486 (patch)
tree21db5a7150760ebacc684d4df852cddd1411f9bd /scripts/qmp/qmp-shell
parent50f6f1c3081322a1d9e2d0bbe5c9f434d712cf50 (diff)
downloadfocaccia-qemu-2813dee0536c1b5d114c0fa0bdeb25317a38f486.tar.gz
focaccia-qemu-2813dee0536c1b5d114c0fa0bdeb25317a38f486.zip
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>
Diffstat (limited to 'scripts/qmp/qmp-shell')
-rwxr-xr-xscripts/qmp/qmp-shell6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index ea6a87e0b3..8d84467b53 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -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):