Skip to content

Commit b025b3f

Browse files
committed
update output structure
1 parent ba6a8be commit b025b3f

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

tools/fqbn.py

+33-9
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,43 @@
7171

7272
line = boardstxt.readline()
7373

74-
75-
for p in menuentries:
76-
for q in menuentries[p]:
77-
menuentries[p][q] = menudescs[p] + ': ' + menuentries[p][q]
74+
# end parsing
75+
# now formatting
7876

7977
for h in hide:
8078
del menuentries[h]
8179

82-
all = collections.OrderedDict([
83-
( 'boards', boards ),
84-
( 'options', menudescs ),
85-
( 'values', menuentries )
86-
])
80+
all = { }
81+
82+
all["options"] = [ ]
83+
for entry in menuentries:
84+
list = [ ]
85+
for value in menuentries[entry]:
86+
subdict = { }
87+
subdict["value"] = value
88+
subdict["description"] = menuentries[entry][value]
89+
list.append(subdict)
90+
dict = { }
91+
dict["values"] = list
92+
dict["ID"] = entry
93+
dict["description"] = menudescs[entry]
94+
all["options"].append(dict)
95+
96+
all["menus"] = [ ]
97+
for desc in menudescs:
98+
dict = { }
99+
dict["description"] = menudescs[desc]
100+
dict["ID"] = desc
101+
all["menus"].append(dict)
102+
103+
all["boards"] = [ ]
104+
for board in boards:
105+
dict = { }
106+
dict["description"] = boards[board]
107+
dict["ID"] = board
108+
all["boards"].append(dict)
109+
110+
# display
87111

88112
if args.machine:
89113
print(json.dumps(all))

0 commit comments

Comments
 (0)