From 299008be36076343edadb7a36bf2fff820425ad1 Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 24 Mar 2021 09:26:38 -0700 Subject: Add support for qmk_configurator style aliases (#11954) * Add support for qmk_configurator style aliases * add the keyboard aliases to the api data * add support for a keyboard metadata file * make flake8 happy --- lib/python/qmk/commands.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/python/qmk/commands.py') diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py index 6a57c1ff5d..d742f67560 100644 --- a/lib/python/qmk/commands.py +++ b/lib/python/qmk/commands.py @@ -13,6 +13,7 @@ from milc import cli import qmk.keymap from qmk.constants import KEYBOARD_OUTPUT_PREFIX +from qmk.json_schema import json_load time_fmt = '%Y-%m-%d-%H:%M:%S' @@ -190,6 +191,15 @@ def parse_configurator_json(configurator_file): """ # FIXME(skullydazed/anyone): Add validation here user_keymap = json.load(configurator_file) + orig_keyboard = user_keymap['keyboard'] + aliases = json_load(Path('data/mappings/keyboard_aliases.json')) + + if orig_keyboard in aliases: + if 'target' in aliases[orig_keyboard]: + user_keymap['keyboard'] = aliases[orig_keyboard]['target'] + + if 'layouts' in aliases[orig_keyboard] and user_keymap['layout'] in aliases[orig_keyboard]['layouts']: + user_keymap['layout'] = aliases[orig_keyboard]['layouts'][user_keymap['layout']] return user_keymap -- cgit v1.2.3