From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: "David Edmondson" <david.edmondson@oracle.com>,
peter.maydell@linaro.org,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL 1/2] qmp-shell: Sort by key when pretty-printing
Date: Tue, 27 Oct 2020 11:17:06 +0100 [thread overview]
Message-ID: <20201027101707.2988553-2-armbru@redhat.com> (raw)
In-Reply-To: <20201027101707.2988553-1-armbru@redhat.com>
From: David Edmondson <david.edmondson@oracle.com>
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>
---
scripts/qmp/qmp-shell | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index c5eef06f3f..b4d06096ab 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):
--
2.26.2
next prev parent reply other threads:[~2020-10-27 10:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 10:17 [PULL 0/2] QMP patches patches for 2020-10-27 Markus Armbruster
2020-10-27 10:17 ` Markus Armbruster [this message]
2020-10-27 10:17 ` [PULL 2/2] scripts/qmp: delete 'qmp' script Markus Armbruster
2020-10-29 11:32 ` [PULL 0/2] QMP patches patches for 2020-10-27 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201027101707.2988553-2-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=david.edmondson@oracle.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).