mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[enh] Sort result when pretty printing result from the cli
This commit is contained in:
parent
346e5a164f
commit
a852861b2d
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@ import errno
|
||||||
import getpass
|
import getpass
|
||||||
import locale
|
import locale
|
||||||
from argparse import SUPPRESS
|
from argparse import SUPPRESS
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
import argcomplete
|
import argcomplete
|
||||||
|
|
||||||
|
@ -98,7 +99,11 @@ def pretty_print_dict(d, depth=0):
|
||||||
- depth -- The recursive depth of the dictionary
|
- depth -- The recursive depth of the dictionary
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for k,v in d.items():
|
keys = d.keys()
|
||||||
|
if not isinstance(d, OrderedDict):
|
||||||
|
keys = sorted(keys)
|
||||||
|
for k in keys:
|
||||||
|
v = d[k]
|
||||||
k = colorize(str(k), 'purple')
|
k = colorize(str(k), 'purple')
|
||||||
if isinstance(v, (tuple, set)):
|
if isinstance(v, (tuple, set)):
|
||||||
v = list(v)
|
v = list(v)
|
||||||
|
|
Loading…
Add table
Reference in a new issue