diff options
author | David Edmondson <david.edmondson@oracle.com> | 2020-10-13 15:14:14 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-10-27 11:11:06 +0100 |
commit | fca9d723232a8bc756ca74982ee342f73ebf833c (patch) | |
tree | 30eb88bc89e9e9f03b11bdb6d9c2b42ef484a66a /scripts/qmp | |
parent | 1dc887329a10903940501b43e8c0cc67af7c06d5 (diff) | |
download | qemu-fca9d723232a8bc756ca74982ee342f73ebf833c.zip qemu-fca9d723232a8bc756ca74982ee342f73ebf833c.tar.gz qemu-fca9d723232a8bc756ca74982ee342f73ebf833c.tar.bz2 |
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>
Diffstat (limited to 'scripts/qmp')
-rwxr-xr-x | scripts/qmp/qmp-shell | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index c5eef06..b4d0609 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -260,7 +260,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): indent = None if self._pretty: indent = 4 - jsobj = json.dumps(qmp, indent=indent) + jsobj = json.dumps(qmp, indent=indent, sort_keys=self._pretty) print(str(jsobj)) def _execute_cmd(self, cmdline): |