diff options
author | John Snow <jsnow@redhat.com> | 2021-06-07 16:06:36 -0400 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2021-06-18 16:10:07 -0400 |
commit | 6e24a7edb8b64854636acd1f74abd8e5f1735b50 (patch) | |
tree | 33b87603f6251c55aa6045fd4368f29a9b9a3ece /scripts/qmp | |
parent | b0b8ca17e518bc57ae231ade4be4a7ed0e5f07f1 (diff) | |
download | qemu-6e24a7edb8b64854636acd1f74abd8e5f1735b50.zip qemu-6e24a7edb8b64854636acd1f74abd8e5f1735b50.tar.gz qemu-6e24a7edb8b64854636acd1f74abd8e5f1735b50.tar.bz2 |
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/qmp')
-rwxr-xr-x | scripts/qmp/qmp-shell | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index b465c7f..f14fe21 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: |