[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell
From: |
John Snow |
Subject: |
[PATCH v2 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell |
Date: |
Tue, 3 Nov 2020 19:35:38 -0500 |
It's less useful, but it makes the initialization methods LSP
consistent.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qmp-shell | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 5a72b9d39502..ba27e9801c68 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -319,8 +319,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):
@@ -418,12 +418,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
--
2.26.2
- [PATCH v2 39/72] scripts/qmp-shell: make QMPCompleter returns explicit, (continued)
- [PATCH v2 39/72] scripts/qmp-shell: make QMPCompleter returns explicit, John Snow, 2020/11/03
- [PATCH v2 42/72] scripts/qmp-shell: explicitly chain exception context, John Snow, 2020/11/03
- [PATCH v2 37/72] scripts/qmp-shell: use triple-double-quote docstring style, John Snow, 2020/11/03
- [PATCH v2 43/72] scripts/qmp-shell: remove if-raise-else patterns, John Snow, 2020/11/03
- [PATCH v2 41/72] scripts/qmp-shell: fix shell history exception handling, John Snow, 2020/11/03
- [PATCH v2 44/72] scripts/qmp-shell: use isinstance() instead of type(), John Snow, 2020/11/03
- [PATCH v2 45/72] scripts/qmp-shell: use argparse, John Snow, 2020/11/03
- [PATCH v2 46/72] python/qmp: Fix type of SocketAddrT, John Snow, 2020/11/03
- [PATCH v2 38/72] scripts/qmp-shell: ignore visit_Name name, John Snow, 2020/11/03
- [PATCH v2 47/72] python/qmp: add parse_address classmethod, John Snow, 2020/11/03
- [PATCH v2 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell,
John Snow <=
- [PATCH v2 49/72] scripts/qmp-shell: Make verbose a public attribute, John Snow, 2020/11/03
- [PATCH v2 50/72] scripts/qmp-shell: move get_prompt() to prompt property, John Snow, 2020/11/03
- [PATCH v2 51/72] scripts/qmp-shell: remove prompt argument from read_exec_command, John Snow, 2020/11/03
- [PATCH v2 52/72] scripts/qmp-shell: move the REPL functionality into QMPShell, John Snow, 2020/11/03
- [PATCH v2 53/72] scripts/qmp-shell: Fix "FuzzyJSON" parser, John Snow, 2020/11/03
- [PATCH v2 54/72] scripts/qmp-shell: refactor QMPCompleter, John Snow, 2020/11/03
- [PATCH v2 56/72] python/qmp: add QMPObject type alias, John Snow, 2020/11/03
- [PATCH v2 59/72] scripts/qmp-shell: unprivatize 'pretty' property, John Snow, 2020/11/03
- [PATCH v2 58/72] scripts/qmp-shell: Accept SocketAddrT instead of string, John Snow, 2020/11/03
- [PATCH v2 55/72] scripts/qmp-shell: initialize completer early, John Snow, 2020/11/03