aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli')
-rw-r--r--lib/python/qmk/cli/c2json.py3
-rwxr-xr-xlib/python/qmk/cli/compile.py3
-rw-r--r--lib/python/qmk/cli/flash.py3
-rwxr-xr-xlib/python/qmk/cli/generate/api.py50
-rwxr-xr-xlib/python/qmk/cli/generate/config_h.py8
-rwxr-xr-xlib/python/qmk/cli/generate/info_json.py8
-rwxr-xr-xlib/python/qmk/cli/generate/layouts.py3
-rwxr-xr-xlib/python/qmk/cli/generate/rules_mk.py8
-rwxr-xr-xlib/python/qmk/cli/info.py4
-rw-r--r--lib/python/qmk/cli/list/keymaps.py8
-rwxr-xr-xlib/python/qmk/cli/new/keymap.py3
11 files changed, 62 insertions, 39 deletions
diff --git a/lib/python/qmk/cli/c2json.py b/lib/python/qmk/cli/c2json.py
index b9d55ebdb..a97e21222 100644
--- a/lib/python/qmk/cli/c2json.py
+++ b/lib/python/qmk/cli/c2json.py
@@ -7,12 +7,13 @@ from milc import cli
7import qmk.keymap 7import qmk.keymap
8import qmk.path 8import qmk.path
9from qmk.info_json_encoder import InfoJSONEncoder 9from qmk.info_json_encoder import InfoJSONEncoder
10from qmk.keyboard import keyboard_folder
10 11
11 12
12@cli.argument('--no-cpp', arg_only=True, action='store_false', help='Do not use \'cpp\' on keymap.c') 13@cli.argument('--no-cpp', arg_only=True, action='store_false', help='Do not use \'cpp\' on keymap.c')
13@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to') 14@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')
14@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") 15@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
15@cli.argument('-kb', '--keyboard', arg_only=True, required=True, help='The keyboard\'s name') 16@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, required=True, help='The keyboard\'s name')
16@cli.argument('-km', '--keymap', arg_only=True, required=True, help='The keymap\'s name') 17@cli.argument('-km', '--keymap', arg_only=True, required=True, help='The keymap\'s name')
17@cli.argument('filename', arg_only=True, help='keymap.c file') 18@cli.argument('filename', arg_only=True, help='keymap.c file')
18@cli.subcommand('Creates a keymap.json from a keymap.c file.') 19@cli.subcommand('Creates a keymap.json from a keymap.c file.')
diff --git a/lib/python/qmk/cli/compile.py b/lib/python/qmk/cli/compile.py
index db195f78a..5793e9892 100755
--- a/lib/python/qmk/cli/compile.py
+++ b/lib/python/qmk/cli/compile.py
@@ -7,10 +7,11 @@ from milc import cli
7import qmk.path 7import qmk.path
8from qmk.decorators import automagic_keyboard, automagic_keymap 8from qmk.decorators import automagic_keyboard, automagic_keymap
9from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json 9from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json
10from qmk.keyboard import keyboard_folder
10 11
11 12
12@cli.argument('filename', nargs='?', arg_only=True, type=qmk.path.FileType('r'), help='The configurator export to compile') 13@cli.argument('filename', nargs='?', arg_only=True, type=qmk.path.FileType('r'), help='The configurator export to compile')
13@cli.argument('-kb', '--keyboard', help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.') 14@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.')
14@cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Ignored when a configurator export is supplied.') 15@cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Ignored when a configurator export is supplied.')
15@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the make command to be run.") 16@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the make command to be run.")
16@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") 17@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.")
diff --git a/lib/python/qmk/cli/flash.py b/lib/python/qmk/cli/flash.py
index 173dee3df..c9273c3f9 100644
--- a/lib/python/qmk/cli/flash.py
+++ b/lib/python/qmk/cli/flash.py
@@ -9,6 +9,7 @@ from milc import cli
9import qmk.path 9import qmk.path
10from qmk.decorators import automagic_keyboard, automagic_keymap 10from qmk.decorators import automagic_keyboard, automagic_keymap
11from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json 11from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json
12from qmk.keyboard import keyboard_folder
12 13
13 14
14def print_bootloader_help(): 15def print_bootloader_help():
@@ -33,7 +34,7 @@ def print_bootloader_help():
33@cli.argument('-b', '--bootloaders', action='store_true', help='List the available bootloaders.') 34@cli.argument('-b', '--bootloaders', action='store_true', help='List the available bootloaders.')
34@cli.argument('-bl', '--bootloader', default='flash', help='The flash command, corresponding to qmk\'s make options of bootloaders.') 35@cli.argument('-bl', '--bootloader', default='flash', help='The flash command, corresponding to qmk\'s make options of bootloaders.')
35@cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.') 36@cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
36@cli.argument('-kb', '--keyboard', help='The keyboard to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.') 37@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='The keyboard to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.')
37@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the make command to be run.") 38@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the make command to be run.")
38@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") 39@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.")
39@cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.") 40@cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.")
diff --git a/lib/python/qmk/cli/generate/api.py b/lib/python/qmk/cli/generate/api.py
index 6d111f244..9870f7201 100755
--- a/lib/python/qmk/cli/generate/api.py
+++ b/lib/python/qmk/cli/generate/api.py
@@ -9,6 +9,7 @@ from milc import cli
9from qmk.datetime import current_datetime 9from qmk.datetime import current_datetime
10from qmk.info import info_json 10from qmk.info import info_json
11from qmk.info_json_encoder import InfoJSONEncoder 11from qmk.info_json_encoder import InfoJSONEncoder
12from qmk.json_schema import json_load
12from qmk.keyboard import list_keyboards 13from qmk.keyboard import list_keyboards
13 14
14 15
@@ -18,43 +19,58 @@ def generate_api(cli):
18 """ 19 """
19 api_data_dir = Path('api_data') 20 api_data_dir = Path('api_data')
20 v1_dir = api_data_dir / 'v1' 21 v1_dir = api_data_dir / 'v1'
21 keyboard_list = v1_dir / 'keyboard_list.json' 22 keyboard_all_file = v1_dir / 'keyboards.json' # A massive JSON containing everything
22 keyboard_all = v1_dir / 'keyboards.json' 23 keyboard_list_file = v1_dir / 'keyboard_list.json' # A simple list of keyboard targets
23 usb_file = v1_dir / 'usb.json' 24 keyboard_aliases_file = v1_dir / 'keyboard_aliases.json' # A list of historical keyboard names and their new name
25 keyboard_metadata_file = v1_dir / 'keyboard_metadata.json' # All the data configurator/via needs for initialization
26 usb_file = v1_dir / 'usb.json' # A mapping of USB VID/PID -> keyboard target
24 27
25 if not api_data_dir.exists(): 28 if not api_data_dir.exists():
26 api_data_dir.mkdir() 29 api_data_dir.mkdir()
27 30
28 kb_all = {'last_updated': current_datetime(), 'keyboards': {}} 31 kb_all = {}
29 usb_list = {'last_updated': current_datetime(), 'devices': {}} 32 usb_list = {}
30 33
31 # Generate and write keyboard specific JSON files 34 # Generate and write keyboard specific JSON files
32 for keyboard_name in list_keyboards(): 35 for keyboard_name in list_keyboards():
33 kb_all['keyboards'][keyboard_name] = info_json(keyboard_name) 36 kb_all[keyboard_name] = info_json(keyboard_name)
34 keyboard_dir = v1_dir / 'keyboards' / keyboard_name 37 keyboard_dir = v1_dir / 'keyboards' / keyboard_name
35 keyboard_info = keyboard_dir / 'info.json' 38 keyboard_info = keyboard_dir / 'info.json'
36 keyboard_readme = keyboard_dir / 'readme.md' 39 keyboard_readme = keyboard_dir / 'readme.md'
37 keyboard_readme_src = Path('keyboards') / keyboard_name / 'readme.md' 40 keyboard_readme_src = Path('keyboards') / keyboard_name / 'readme.md'
38 41
39 keyboard_dir.mkdir(parents=True, exist_ok=True) 42 keyboard_dir.mkdir(parents=True, exist_ok=True)
40 keyboard_info.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': {keyboard_name: kb_all['keyboards'][keyboard_name]}})) 43 keyboard_info.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': {keyboard_name: kb_all[keyboard_name]}}))
41 44
42 if keyboard_readme_src.exists(): 45 if keyboard_readme_src.exists():
43 copyfile(keyboard_readme_src, keyboard_readme) 46 copyfile(keyboard_readme_src, keyboard_readme)
44 47
45 if 'usb' in kb_all['keyboards'][keyboard_name]: 48 if 'usb' in kb_all[keyboard_name]:
46 usb = kb_all['keyboards'][keyboard_name]['usb'] 49 usb = kb_all[keyboard_name]['usb']
47 50
48 if 'vid' in usb and usb['vid'] not in usb_list['devices']: 51 if 'vid' in usb and usb['vid'] not in usb_list:
49 usb_list['devices'][usb['vid']] = {} 52 usb_list[usb['vid']] = {}
50 53
51 if 'pid' in usb and usb['pid'] not in usb_list['devices'][usb['vid']]: 54 if 'pid' in usb and usb['pid'] not in usb_list[usb['vid']]:
52 usb_list['devices'][usb['vid']][usb['pid']] = {} 55 usb_list[usb['vid']][usb['pid']] = {}
53 56
54 if 'vid' in usb and 'pid' in usb: 57 if 'vid' in usb and 'pid' in usb:
55 usb_list['devices'][usb['vid']][usb['pid']][keyboard_name] = usb 58 usb_list[usb['vid']][usb['pid']][keyboard_name] = usb
56 59
57 # Write the global JSON files 60 # Write the global JSON files
58 keyboard_list.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': sorted(kb_all['keyboards'])}, cls=InfoJSONEncoder)) 61 keyboard_all_file.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': kb_all}, cls=InfoJSONEncoder))
59 keyboard_all.write_text(json.dumps(kb_all, cls=InfoJSONEncoder)) 62 usb_file.write_text(json.dumps({'last_updated': current_datetime(), 'usb': usb_list}, cls=InfoJSONEncoder))
60 usb_file.write_text(json.dumps(usb_list, cls=InfoJSONEncoder)) 63
64 keyboard_list = sorted(kb_all)
65 keyboard_list_file.write_text(json.dumps({'last_updated': current_datetime(), 'keyboards': keyboard_list}, cls=InfoJSONEncoder))
66
67 keyboard_aliases = json_load(Path('data/mappings/keyboard_aliases.json'))
68 keyboard_aliases_file.write_text(json.dumps({'last_updated': current_datetime(), 'keyboard_aliases': keyboard_aliases}, cls=InfoJSONEncoder))
69
70 keyboard_metadata = {
71 'last_updated': current_datetime(),
72 'keyboards': keyboard_list,
73 'keyboard_aliases': keyboard_aliases,
74 'usb': usb_list
75 }
76 keyboard_metadata_file.write_text(json.dumps(keyboard_metadata, cls=InfoJSONEncoder))
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index e6d49ea4d..ccea6d7a0 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -6,7 +6,9 @@ from dotty_dict import dotty
6from milc import cli 6from milc import cli
7 7
8from qmk.decorators import automagic_keyboard, automagic_keymap 8from qmk.decorators import automagic_keyboard, automagic_keymap
9from qmk.info import _json_load, info_json 9from qmk.info import info_json
10from qmk.json_schema import json_load
11from qmk.keyboard import keyboard_folder
10from qmk.path import is_keyboard, normpath 12from qmk.path import is_keyboard, normpath
11 13
12 14
@@ -73,7 +75,7 @@ def matrix_pins(matrix_pins):
73 75
74@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') 76@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to')
75@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") 77@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
76@cli.argument('-kb', '--keyboard', help='Keyboard to generate config.h for.') 78@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to generate config.h for.')
77@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) 79@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True)
78@automagic_keyboard 80@automagic_keyboard
79@automagic_keymap 81@automagic_keymap
@@ -92,7 +94,7 @@ def generate_config_h(cli):
92 94
93 # Build the info_config.h file. 95 # Build the info_config.h file.
94 kb_info_json = dotty(info_json(cli.config.generate_config_h.keyboard)) 96 kb_info_json = dotty(info_json(cli.config.generate_config_h.keyboard))
95 info_config_map = _json_load(Path('data/mappings/info_config.json')) 97 info_config_map = json_load(Path('data/mappings/info_config.json'))
96 98
97 config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.' ' */', '', '#pragma once'] 99 config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.' ' */', '', '#pragma once']
98 100
diff --git a/lib/python/qmk/cli/generate/info_json.py b/lib/python/qmk/cli/generate/info_json.py
index f3fc54ddc..6c00ba7d8 100755
--- a/lib/python/qmk/cli/generate/info_json.py
+++ b/lib/python/qmk/cli/generate/info_json.py
@@ -8,8 +8,10 @@ from jsonschema import Draft7Validator, validators
8from milc import cli 8from milc import cli
9 9
10from qmk.decorators import automagic_keyboard, automagic_keymap 10from qmk.decorators import automagic_keyboard, automagic_keymap
11from qmk.info import info_json, _jsonschema 11from qmk.info import info_json
12from qmk.info_json_encoder import InfoJSONEncoder 12from qmk.info_json_encoder import InfoJSONEncoder
13from qmk.json_schema import load_jsonschema
14from qmk.keyboard import keyboard_folder
13from qmk.path import is_keyboard 15from qmk.path import is_keyboard
14 16
15 17
@@ -33,13 +35,13 @@ def strip_info_json(kb_info_json):
33 """Remove the API-only properties from the info.json. 35 """Remove the API-only properties from the info.json.
34 """ 36 """
35 pruning_draft_7_validator = pruning_validator(Draft7Validator) 37 pruning_draft_7_validator = pruning_validator(Draft7Validator)
36 schema = _jsonschema('keyboard') 38 schema = load_jsonschema('keyboard')
37 validator = pruning_draft_7_validator(schema).validate 39 validator = pruning_draft_7_validator(schema).validate
38 40
39 return validator(kb_info_json) 41 return validator(kb_info_json)
40 42
41 43
42@cli.argument('-kb', '--keyboard', help='Keyboard to show info for.') 44@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to show info for.')
43@cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.') 45@cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.')
44@cli.subcommand('Generate an info.json file for a keyboard.', hidden=False if cli.config.user.developer else True) 46@cli.subcommand('Generate an info.json file for a keyboard.', hidden=False if cli.config.user.developer else True)
45@automagic_keyboard 47@automagic_keyboard
diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py
index a738edfe6..7b4394291 100755
--- a/lib/python/qmk/cli/generate/layouts.py
+++ b/lib/python/qmk/cli/generate/layouts.py
@@ -5,6 +5,7 @@ from milc import cli
5from qmk.constants import COL_LETTERS, ROW_LETTERS 5from qmk.constants import COL_LETTERS, ROW_LETTERS
6from qmk.decorators import automagic_keyboard, automagic_keymap 6from qmk.decorators import automagic_keyboard, automagic_keymap
7from qmk.info import info_json 7from qmk.info import info_json
8from qmk.keyboard import keyboard_folder
8from qmk.path import is_keyboard, normpath 9from qmk.path import is_keyboard, normpath
9 10
10usb_properties = { 11usb_properties = {
@@ -16,7 +17,7 @@ usb_properties = {
16 17
17@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') 18@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to')
18@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") 19@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
19@cli.argument('-kb', '--keyboard', help='Keyboard to generate config.h for.') 20@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to generate config.h for.')
20@cli.subcommand('Used by the make system to generate layouts.h from info.json', hidden=True) 21@cli.subcommand('Used by the make system to generate layouts.h from info.json', hidden=True)
21@automagic_keyboard 22@automagic_keyboard
22@automagic_keymap 23@automagic_keymap
diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py
index 15917987b..91759d26c 100755
--- a/lib/python/qmk/cli/generate/rules_mk.py
+++ b/lib/python/qmk/cli/generate/rules_mk.py
@@ -6,7 +6,9 @@ from dotty_dict import dotty
6from milc import cli 6from milc import cli
7 7
8from qmk.decorators import automagic_keyboard, automagic_keymap 8from qmk.decorators import automagic_keyboard, automagic_keymap
9from qmk.info import _json_load, info_json 9from qmk.info import info_json
10from qmk.json_schema import json_load
11from qmk.keyboard import keyboard_folder
10from qmk.path import is_keyboard, normpath 12from qmk.path import is_keyboard, normpath
11 13
12 14
@@ -37,7 +39,7 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict):
37@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') 39@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to')
38@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") 40@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
39@cli.argument('-e', '--escape', arg_only=True, action='store_true', help="Escape spaces in quiet mode") 41@cli.argument('-e', '--escape', arg_only=True, action='store_true', help="Escape spaces in quiet mode")
40@cli.argument('-kb', '--keyboard', help='Keyboard to generate config.h for.') 42@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to generate config.h for.')
41@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) 43@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True)
42@automagic_keyboard 44@automagic_keyboard
43@automagic_keymap 45@automagic_keymap
@@ -54,7 +56,7 @@ def generate_rules_mk(cli):
54 return False 56 return False
55 57
56 kb_info_json = dotty(info_json(cli.config.generate_rules_mk.keyboard)) 58 kb_info_json = dotty(info_json(cli.config.generate_rules_mk.keyboard))
57 info_rules_map = _json_load(Path('data/mappings/info_rules.json')) 59 info_rules_map = json_load(Path('data/mappings/info_rules.json'))
58 rules_mk_lines = ['# This file was generated by `qmk generate-rules-mk`. Do not edit or copy.', ''] 60 rules_mk_lines = ['# This file was generated by `qmk generate-rules-mk`. Do not edit or copy.', '']
59 61
60 # Iterate through the info_rules map to generate basic rules 62 # Iterate through the info_rules map to generate basic rules
diff --git a/lib/python/qmk/cli/info.py b/lib/python/qmk/cli/info.py
index a7ce8abf0..88b65686f 100755
--- a/lib/python/qmk/cli/info.py
+++ b/lib/python/qmk/cli/info.py
@@ -10,7 +10,7 @@ from milc import cli
10from qmk.info_json_encoder import InfoJSONEncoder 10from qmk.info_json_encoder import InfoJSONEncoder
11from qmk.constants import COL_LETTERS, ROW_LETTERS 11from qmk.constants import COL_LETTERS, ROW_LETTERS
12from qmk.decorators import automagic_keyboard, automagic_keymap 12from qmk.decorators import automagic_keyboard, automagic_keymap
13from qmk.keyboard import render_layouts, render_layout 13from qmk.keyboard import keyboard_folder, render_layouts, render_layout
14from qmk.keymap import locate_keymap 14from qmk.keymap import locate_keymap
15from qmk.info import info_json 15from qmk.info import info_json
16from qmk.path import is_keyboard 16from qmk.path import is_keyboard
@@ -124,7 +124,7 @@ def print_text_output(kb_info_json):
124 show_keymap(kb_info_json, False) 124 show_keymap(kb_info_json, False)
125 125
126 126
127@cli.argument('-kb', '--keyboard', help='Keyboard to show info for.') 127@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Keyboard to show info for.')
128@cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.') 128@cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.')
129@cli.argument('-l', '--layouts', action='store_true', help='Render the layouts.') 129@cli.argument('-l', '--layouts', action='store_true', help='Render the layouts.')
130@cli.argument('-m', '--matrix', action='store_true', help='Render the layouts with matrix information.') 130@cli.argument('-m', '--matrix', action='store_true', help='Render the layouts with matrix information.')
diff --git a/lib/python/qmk/cli/list/keymaps.py b/lib/python/qmk/cli/list/keymaps.py
index 49bc84b2c..7c0ad4399 100644
--- a/lib/python/qmk/cli/list/keymaps.py
+++ b/lib/python/qmk/cli/list/keymaps.py
@@ -4,18 +4,14 @@ from milc import cli
4 4
5import qmk.keymap 5import qmk.keymap
6from qmk.decorators import automagic_keyboard 6from qmk.decorators import automagic_keyboard
7from qmk.path import is_keyboard 7from qmk.keyboard import keyboard_folder
8 8
9 9
10@cli.argument("-kb", "--keyboard", help="Specify keyboard name. Example: 1upkeyboards/1up60hse") 10@cli.argument("-kb", "--keyboard", type=keyboard_folder, help="Specify keyboard name. Example: 1upkeyboards/1up60hse")
11@cli.subcommand("List the keymaps for a specific keyboard") 11@cli.subcommand("List the keymaps for a specific keyboard")
12@automagic_keyboard 12@automagic_keyboard
13def list_keymaps(cli): 13def list_keymaps(cli):
14 """List the keymaps for a specific keyboard 14 """List the keymaps for a specific keyboard
15 """ 15 """
16 if not is_keyboard(cli.config.list_keymaps.keyboard):
17 cli.log.error('Keyboard %s does not exist!', cli.config.list_keymaps.keyboard)
18 return False
19
20 for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard): 16 for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
21 print(name) 17 print(name)
diff --git a/lib/python/qmk/cli/new/keymap.py b/lib/python/qmk/cli/new/keymap.py
index 52c564997..ea98a287c 100755
--- a/lib/python/qmk/cli/new/keymap.py
+++ b/lib/python/qmk/cli/new/keymap.py
@@ -5,10 +5,11 @@ from pathlib import Path
5 5
6import qmk.path 6import qmk.path
7from qmk.decorators import automagic_keyboard, automagic_keymap 7from qmk.decorators import automagic_keyboard, automagic_keymap
8from qmk.keyboard import keyboard_folder
8from milc import cli 9from milc import cli
9 10
10 11
11@cli.argument('-kb', '--keyboard', help='Specify keyboard name. Example: 1upkeyboards/1up60hse') 12@cli.argument('-kb', '--keyboard', type=keyboard_folder, help='Specify keyboard name. Example: 1upkeyboards/1up60hse')
12@cli.argument('-km', '--keymap', help='Specify the name for the new keymap directory') 13@cli.argument('-km', '--keymap', help='Specify the name for the new keymap directory')
13@cli.subcommand('Creates a new keymap for the keyboard of your choosing') 14@cli.subcommand('Creates a new keymap for the keyboard of your choosing')
14@automagic_keyboard 15@automagic_keyboard