scripts/qmp-shell: move get_prompt() to prompt property

Small tidying; treat "prompt" like an immutable property instead of
function/method/routine.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-21-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
John Snow 2021-06-07 16:06:27 -04:00
parent 2ac3f3786e
commit 1caa505766
1 changed files with 5 additions and 4 deletions

View File

@ -292,10 +292,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
version = self._greeting['QMP']['version']['qemu']
print("Connected to QEMU {major}.{minor}.{micro}\n".format(**version))
def get_prompt(self):
@property
def prompt(self):
if self._transmode:
return "TRANS> "
return "(QEMU) "
return 'TRANS> '
return '(QEMU) '
def read_exec_command(self, prompt):
"""
@ -435,7 +436,7 @@ def main():
die(f"Couldn't connect to {args.qmp_server}: {err!s}")
qemu.show_banner()
while qemu.read_exec_command(qemu.get_prompt()):
while qemu.read_exec_command(qemu.prompt):
pass
qemu.close()