diff options
author | John Snow <jsnow@redhat.com> | 2021-06-07 16:06:25 -0400 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2021-06-18 16:10:07 -0400 |
commit | ad459132c088dc9b33e86b8ad87f96742e4de4bf (patch) | |
tree | 5d6af1b162b2e9c85016c1cce27b1202ebdaea7b /scripts/qmp | |
parent | 17329be2fd1557c3e1e30ce3d0f714fc70c4e5be (diff) |
scripts/qmp-shell: Add pretty attribute to HMP shell
It's less useful, but it makes the initialization methods LSP
consistent, which quiets a mypy complaint.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-19-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'scripts/qmp')
-rwxr-xr-x | scripts/qmp/qmp-shell | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index 5317dcd516..de5fa189f0 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -322,8 +322,8 @@ class QMPShell(qmp.QEMUMonitorProtocol): class HMPShell(QMPShell): - def __init__(self, address): - super().__init__(address) + def __init__(self, address, pretty=False): + super().__init__(address, pretty) self.__cpu_index = 0 def __cmd_completion(self): @@ -421,12 +421,9 @@ def main(): if args.qmp_server is None: parser.error("QMP socket or TCP address must be specified") - qemu: QMPShell + shell_class = HMPShell if args.hmp else QMPShell try: - if args.hmp: - qemu = HMPShell(args.qmp_server) - else: - qemu = QMPShell(args.qmp_server, args.pretty) + qemu = shell_class(args.qmp_server, args.pretty) except qmp.QMPBadPortError: parser.error(f"Bad port number: {args.qmp_server}") return # pycharm doesn't know error() is noreturn |