diff options
author | Nick Brassel <[email protected]> | 2023-11-28 07:53:43 +1100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-28 07:53:43 +1100 |
commit | 5501e804ff8d41ce656061b91896c4ac8c681d78 (patch) | |
tree | 6a655fbceaeab67cf727dbe4318721407dd31824 /lib/python/qmk/json_encoders.py | |
parent | 094357c40347e8a5db36578851f1af34a92e9f68 (diff) | |
download | qmk_firmware-5501e804ff8d41ce656061b91896c4ac8c681d78.tar.gz qmk_firmware-5501e804ff8d41ce656061b91896c4ac8c681d78.zip |
QMK Userspace (#22222)
Co-authored-by: Duncan Sutherland <[email protected]>
Diffstat (limited to 'lib/python/qmk/json_encoders.py')
-rwxr-xr-x | lib/python/qmk/json_encoders.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/python/qmk/json_encoders.py b/lib/python/qmk/json_encoders.py index 1e90f6a288..0e4ad1d220 100755 --- a/lib/python/qmk/json_encoders.py +++ b/lib/python/qmk/json_encoders.py @@ -217,3 +217,21 @@ class KeymapJSONEncoder(QMKJSONEncoder): return '50' + str(key) return key + + +class UserspaceJSONEncoder(QMKJSONEncoder): + """Custom encoder to make userspace qmk.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 == 'userspace_version': + return '00userspace_version' + + if key == 'build_targets': + return '01build_targets' + + return key |