attempt to improve '-K' output for lists
- use [N] instead if [] to indicate a Number needs to be placed there - enumerate list items
This commit is contained in:
@@ -605,12 +605,15 @@ class KeywordJob(Job):
|
||||
self.print_kwdict(value, key + "[", markers)
|
||||
|
||||
elif isinstance(value, list):
|
||||
if value and isinstance(value[0], dict):
|
||||
self.print_kwdict(value[0], key + "[][", markers)
|
||||
if not value:
|
||||
pass
|
||||
elif isinstance(value[0], dict):
|
||||
self.print_kwdict(value[0], key + "[N][", markers)
|
||||
else:
|
||||
write(key + "[]\n")
|
||||
for val in value:
|
||||
write(" - " + str(val) + "\n")
|
||||
fmt = (" {:>%s} {}\n" % len(str(len(value)))).format
|
||||
write(key + "[N]\n")
|
||||
for idx, val in enumerate(value, 0):
|
||||
write(fmt(idx, val))
|
||||
|
||||
else:
|
||||
# string or number
|
||||
|
||||
@@ -87,10 +87,10 @@ num
|
||||
1
|
||||
subcategory
|
||||
test_subcategory
|
||||
tags[]
|
||||
- foo
|
||||
- bar
|
||||
- テスト
|
||||
tags[N]
|
||||
0 foo
|
||||
1 bar
|
||||
2 テスト
|
||||
user[id]
|
||||
123
|
||||
user[name]
|
||||
|
||||
Reference in New Issue
Block a user