comparison sat_frontends/jp/cmd_info.py @ 2710:b6e16a89311b

jp (info/disco): better default output for extensions
author Goffi <goffi@goffi.org>
date Sat, 01 Dec 2018 14:35:28 +0100
parents 263a00e90174
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2709:46f2733a2a9b 2710:b6e16a89311b
101 field_lines = [] 101 field_lines = []
102 data, values = field 102 data, values = field
103 data_keys = data.keys() 103 data_keys = data.keys()
104 data_keys.sort() 104 data_keys.sort()
105 for key in data_keys: 105 for key in data_keys:
106 field_lines.append(A.color(u'\t', C.A_SUBHEADER, key, data[key])) 106 field_lines.append(A.color(u'\t', C.A_SUBHEADER, key, A.RESET, u': ',
107 for value in values: 107 data[key]))
108 field_lines.append(A.color(u'\t', A.BOLD, value)) 108 if len(values) == 1:
109 field_lines.append(A.color(u'\t', C.A_SUBHEADER, u"value", A.RESET,
110 u': ', values[0] or (A.BOLD + u"UNSET")))
111 elif len(values) > 1:
112 field_lines.append(A.color(u'\t', C.A_SUBHEADER, u"values", A.RESET,
113 u': '))
114
115 for value in values:
116 field_lines.append(A.color(u'\t - ', A.BOLD, value))
109 fields.append(u'\n'.join(field_lines)) 117 fields.append(u'\n'.join(field_lines))
110 extensions_tpl.append(u'{type_}\n{fields}'.format(type_=type_, 118 extensions_tpl.append(u'{type_}\n{fields}'.format(type_=type_,
111 fields='\n\n'.join(fields))) 119 fields='\n\n'.join(fields)))
112 120
113 items_table = common.Table(self.host, 121 items_table = common.Table(self.host,