|
|
@@ -10,7 +10,17 @@ import qmk.path
|
|
|
from qmk.decorators import automagic_keyboard, automagic_keymap
|
|
|
from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json, build_environment
|
|
|
from qmk.keyboard import keyboard_completer, keyboard_folder
|
|
|
-from qmk.keymap import keymap_completer
|
|
|
+from qmk.keymap import keymap_completer, locate_keymap
|
|
|
+
|
|
|
+
|
|
|
+def _is_keymap_target(keyboard, keymap):
|
|
|
+ if keymap == 'all':
|
|
|
+ return True
|
|
|
+
|
|
|
+ if locate_keymap(keyboard, keymap):
|
|
|
+ return True
|
|
|
+
|
|
|
+ return False
|
|
|
|
|
|
|
|
|
@cli.argument('filename', nargs='?', arg_only=True, type=qmk.path.FileType('r'), completer=FilesCompleter('.json'), help='The configurator export to compile')
|
|
|
@@ -43,6 +53,11 @@ def compile(cli):
|
|
|
|
|
|
elif cli.config.compile.keyboard and cli.config.compile.keymap:
|
|
|
# Generate the make command for a specific keyboard/keymap.
|
|
|
+ if not _is_keymap_target(cli.config.compile.keyboard, cli.config.compile.keymap):
|
|
|
+ cli.log.error('Invalid keymap argument.')
|
|
|
+ cli.print_help()
|
|
|
+ return False
|
|
|
+
|
|
|
if cli.args.clean:
|
|
|
commands.append(create_make_command(cli.config.compile.keyboard, cli.config.compile.keymap, 'clean', **envs))
|
|
|
commands.append(create_make_command(cli.config.compile.keyboard, cli.config.compile.keymap, parallel=cli.config.compile.parallel, **envs))
|