keyboard stuff
1from milc import cli
2
3from qmk.importers import import_keymap as _import_keymap
4from qmk.path import FileType
5from qmk.json_schema import json_load
6
7
8@cli.argument('filename', type=FileType('r'), nargs='+', arg_only=True, help='file')
9@cli.subcommand('Import data-driven keymap')
10def import_keymap(cli):
11 filename = cli.args.filename[0]
12
13 data = json_load(filename)
14
15 cli.log.info(f'{{style_bright}}Importing {filename.name}.{{style_normal}}')
16 cli.echo('')
17
18 kb_name, km_name = _import_keymap(data)
19
20 cli.log.info(f'{{fg_green}}Imported a new keymap named {{fg_cyan}}{km_name}{{fg_green}}.{{fg_reset}}')
21 cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}/keymaps/{km_name}{{fg_reset}},')
22 cli.log.info('or open the directory in your preferred text editor.')
23 cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km {km_name}{{fg_reset}}.")