From: John Snow <jsnow@redhat.com>
To: David Edmondson <david.edmondson@oracle.com>,
qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH] qmp-shell: Sort by key when pretty-printing
Date: Mon, 30 Nov 2020 15:56:51 -0500 [thread overview]
Message-ID: <27cc8383-89e1-5c5f-d8cf-7463810c1fd2@redhat.com> (raw)
In-Reply-To: <20201013141414.18398-1-david.edmondson@oracle.com>
On 10/13/20 10:14 AM, David Edmondson wrote:
> 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>
> ---
> 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):
>
Hi, out of curiosity, what does this help you accomplish?
I've recently been overhauling a LOT of the Python utilities we have, so
I'm interested in hearing about how people use these tools and what
they'd like them to do.
--js
next prev parent reply other threads:[~2020-11-30 20:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 14:14 [PATCH] qmp-shell: Sort by key when pretty-printing David Edmondson
2020-10-13 14:19 ` Philippe Mathieu-Daudé
2020-10-20 6:43 ` Markus Armbruster
2020-11-30 20:56 ` John Snow [this message]
2020-11-30 21:57 ` David Edmondson
2020-12-01 15:17 ` John Snow
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=27cc8383-89e1-5c5f-d8cf-7463810c1fd2@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=david.edmondson@oracle.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).