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):
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