CLI: Add 'via2json' subcommand (#16468)

This commit is contained in:
Erovia authored and GitHub committed 2022-03-24 21:13:40 +01:00
1 parent f7a5ec2483
commit efc9c525b1
5 files changed
+176 -2

No files matched your search

+7 -1
View File
@@ -146,7 +146,13 @@ class KeymapJSONEncoder(QMKJSONEncoder):
if key == 'JSON_NEWLINE':
layer.append([])
else:
layer[-1].append(f'"{key}"')
if isinstance(key, dict):
# We have a macro
# TODO: Add proper support for nicely formatting keymap.json macros
layer[-1].append(f'{self.encode(key)}')
else:
layer[-1].append(f'"{key}"')
layer = [f"{self.indent_str*indent_level}{', '.join(row)}" for row in layer]