Skip to content

Commit

Permalink
scripts/qmp-shell: unprivatize 'pretty' property
Browse files Browse the repository at this point in the history
Similar to verbose, there's no reason this needs to be hidden.

Signed-off-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
  • Loading branch information
jnsnow committed Jun 18, 2021
1 parent b0b8ca1 commit 6e24a7e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions scripts/qmp/qmp-shell
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6e24a7e

Please sign in to comment.