qmp-shell: Sort by key when pretty-printing
If the user selects pretty-printing (-p) the contents of any dictionaries in the output are sorted by key. Signed-off-by: David Edmondson <david.edmondson@oracle.com> Message-Id: <20201013141414.18398-1-david.edmondson@oracle.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
1dc887329a
commit
fca9d72323
@ -260,7 +260,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
|||||||
indent = None
|
indent = None
|
||||||
if self._pretty:
|
if self._pretty:
|
||||||
indent = 4
|
indent = 4
|
||||||
jsobj = json.dumps(qmp, indent=indent)
|
jsobj = json.dumps(qmp, indent=indent, sort_keys=self._pretty)
|
||||||
print(str(jsobj))
|
print(str(jsobj))
|
||||||
|
|
||||||
def _execute_cmd(self, cmdline):
|
def _execute_cmd(self, cmdline):
|
||||||
|
Loading…
Reference in New Issue
Block a user