Community modules (#24848)

This commit is contained in:
Nick Brassel 2025-02-26 22:25:41 +11:00 committed by GitHub
parent 63b095212b
commit 1efc82403b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 987 additions and 84 deletions

View file

@ -235,3 +235,31 @@ class UserspaceJSONEncoder(QMKJSONEncoder):
return '01build_targets'
return key
class CommunityModuleJSONEncoder(QMKJSONEncoder):
"""Custom encoder to make qmk_module.json's a little nicer to work with.
"""
def sort_dict(self, item):
"""Sorts the hashes in a nice way.
"""
key = item[0]
if self.indentation_level == 1:
if key == 'module_name':
return '00module_name'
if key == 'maintainer':
return '01maintainer'
if key == 'url':
return '02url'
if key == 'features':
return '03features'
if key == 'keycodes':
return '04keycodes'
elif self.indentation_level == 3: # keycodes
if key == 'key':
return '00key'
if key == 'aliases':
return '01aliases'
return key