Change console layout to write on 80 char per line

Change-Id: I34ec63d82fc70f650b1131ad54421b3eaa95d18d
This commit is contained in:
flavien.peyre 2015-06-03 14:51:10 -04:00
parent 96db6c3b09
commit 9eabfab731
1 changed files with 16 additions and 2 deletions

View File

@ -65,9 +65,23 @@ def print_item(objs, properties):
]
""" Override the properties keys pass in parameter """
len_property_max=0
for property in properties:
if len(property) > len_property_max:
len_property_max = len(property)
# 80 char per line - 7 char (space or | )
len_available = 73 - len_property_max
list = []
for value in properties:
list.append({'prop': value, 'value': objs[value].__str__()})
for property in properties:
val_lines = []
for i in range(0, len(objs[property].__str__()), len_available):
val_lines.append(objs[property].__str__()[i:i+len_available])
val_lines ='\n'.join(val_lines)
list.append({'prop': property, 'value': val_lines})
formatters = {
'Property': lambda x: x['prop'],