[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qmp-shell: Sort by key when pretty-printing
From: |
Markus Armbruster |
Subject: |
Re: [PATCH] qmp-shell: Sort by key when pretty-printing |
Date: |
Tue, 20 Oct 2020 08:43:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
David Edmondson <david.edmondson@oracle.com> writes:
> 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):
Queued, thanks!