aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-06-07 16:06:36 -0400
committerJohn Snow <jsnow@redhat.com>2021-06-18 16:10:07 -0400
commit6e24a7edb8b64854636acd1f74abd8e5f1735b50 (patch)
tree33b87603f6251c55aa6045fd4368f29a9b9a3ece /scripts
parentb0b8ca17e518bc57ae231ade4be4a7ed0e5f07f1 (diff)
scripts/qmp-shell: unprivatize 'pretty' property
Similar to verbose, there's no reason this needs to be hidden. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-30-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/qmp/qmp-shell9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index b465c7f9e2..f14fe211cc 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -135,11 +135,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
super().__init__(address)
self._greeting: Optional[QMPMessage] = None
self._completer = QMPCompleter()
- self._pretty = pretty
self._transmode = False
self._actions: List[QMPMessage] = []
self._histfile = os.path.join(os.path.expanduser('~'),
'.qmp-shell_history')
+ self.pretty = pretty
self.verbose = verbose
def _fill_completion(self) -> None:
@@ -274,10 +274,9 @@ class QMPShell(qmp.QEMUMonitorProtocol):
return qmpcmd
def _print(self, qmp_message: object) -> None:
- indent = None
- if self._pretty:
- indent = 4
- jsobj = json.dumps(qmp_message, indent=indent, sort_keys=self._pretty)
+ jsobj = json.dumps(qmp_message,
+ indent=4 if self.pretty else None,
+ sort_keys=self.pretty)
print(str(jsobj))
def _execute_cmd(self, cmdline: str) -> bool: