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>
This commit is contained in:
parent
b0b8ca17e5
commit
6e24a7edb8
|
@ -135,11 +135,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
super().__init__(address)
|
super().__init__(address)
|
||||||
self._greeting: Optional[QMPMessage] = None
|
self._greeting: Optional[QMPMessage] = None
|
||||||
self._completer = QMPCompleter()
|
self._completer = QMPCompleter()
|
||||||
self._pretty = pretty
|
|
||||||
self._transmode = False
|
self._transmode = False
|
||||||
self._actions: List[QMPMessage] = []
|
self._actions: List[QMPMessage] = []
|
||||||
self._histfile = os.path.join(os.path.expanduser('~'),
|
self._histfile = os.path.join(os.path.expanduser('~'),
|
||||||
'.qmp-shell_history')
|
'.qmp-shell_history')
|
||||||
|
self.pretty = pretty
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
|
|
||||||
def _fill_completion(self) -> None:
|
def _fill_completion(self) -> None:
|
||||||
|
@ -274,10 +274,9 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
||||||
return qmpcmd
|
return qmpcmd
|
||||||
|
|
||||||
def _print(self, qmp_message: object) -> None:
|
def _print(self, qmp_message: object) -> None:
|
||||||
indent = None
|
jsobj = json.dumps(qmp_message,
|
||||||
if self._pretty:
|
indent=4 if self.pretty else None,
|
||||||
indent = 4
|
sort_keys=self.pretty)
|
||||||
jsobj = json.dumps(qmp_message, indent=indent, sort_keys=self._pretty)
|
|
||||||
print(str(jsobj))
|
print(str(jsobj))
|
||||||
|
|
||||||
def _execute_cmd(self, cmdline: str) -> bool:
|
def _execute_cmd(self, cmdline: str) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue