From 1645cdc1efbf61c1a1a9522b142afb3c5ba038bf Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 16 Mar 2022 08:46:02 +0000 Subject: [PATCH 1/5] Add cli command to import keyboard|keymap|kbfirmware --- lib/python/qmk/cli/__init__.py | 1 + lib/python/qmk/cli/import.py | 193 +++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 lib/python/qmk/cli/import.py diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index 85baa238a8d6..ea4da815afbf 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -58,6 +58,7 @@ 'qmk.cli.generate.rules_mk', 'qmk.cli.generate.version_h', 'qmk.cli.hello', + 'qmk.cli.import', 'qmk.cli.info', 'qmk.cli.json2c', 'qmk.cli.lint', diff --git a/lib/python/qmk/cli/import.py b/lib/python/qmk/cli/import.py new file mode 100644 index 000000000000..c1341863e275 --- /dev/null +++ b/lib/python/qmk/cli/import.py @@ -0,0 +1,193 @@ +from dotty_dict import dotty +import json + +from milc import cli + +from qmk.json_schema import json_load, validate +from qmk.path import keyboard, keymap, FileType +from qmk.constants import MCU2BOOTLOADER + + +def _gen_dummy_keymap(name, info_data): + # Pick the first layout macro and just dump in KC_NOs or something? + (layout_name, layout_data), *_ = info_data["layouts"].items() + layout_length = len(layout_data["layout"]) + + keymap_data = { + "keyboard": name, + "layout": layout_name, + "layers": [["KC_NO" for _ in range(0, layout_length)]], + } + + return json.dumps(keymap_data) + + +def _import_keymap(keymap_data): + # Validate to ensure we don't have to deal with bad data - handles stdin/file + validate(keymap_data, 'qmk.keymap.v1') + + kb_name = keymap_data['keyboard'] + km_name = keymap_data['keymap'] + + km_folder = keymap(kb_name) / km_name + keyboard_keymap = km_folder / 'keymap.json' + + # This is the deepest folder in the expected tree + keyboard_keymap.parent.mkdir(parents=True, exist_ok=True) + + # Dump out all those lovely files + keyboard_keymap.write_text(json.dumps(keymap_data)) + + cli.log.info(f'{{fg_green}}Imported a new keymap named {{fg_cyan}}{km_name}{{fg_green}}.{{fg_reset}}') + cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}/keymaps/{km_name}{{fg_reset}},') + cli.log.info('or open the directory in your preferred text editor.') + cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km {km_name}{{fg_reset}}.") + + +def _import_keyboard(info_data): + # Validate to ensure we don't have to deal with bad data - handles stdin/file + validate(info_data, 'qmk.api.keyboard.v1') + + # And validate some more as everything is optional + if not all(key in info_data for key in ['keyboard_name', 'layouts']): + raise ValueError('invalid info.json') + + kb_name = info_data['keyboard_name'] + + # bail + if keyboard(kb_name).exists(): + cli.log.error(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.') + return 1 + + kb_folder = keyboard(kb_name) + keyboard_info = kb_folder / 'info.json' + keyboard_rules = kb_folder / 'rules.mk' + keyboard_keymap = kb_folder / 'keymaps' / 'default' / 'keymap.json' + + # This is the deepest folder in the expected tree + keyboard_keymap.parent.mkdir(parents=True, exist_ok=True) + + # Dump out all those lovely files + keyboard_info.write_text(json.dumps(info_data)) + keyboard_rules.write_text("# This file intentionally left blank") + keyboard_keymap.write_text(_gen_dummy_keymap(kb_name, info_data)) + + cli.log.info(f'{{fg_green}}Imported a new keyboard named {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}') + cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}{{fg_reset}},') + cli.log.info('or open the directory in your preferred text editor.') + cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.") + + +def _import_kbfirmware(kbfirmware_data): + kbf_data = dotty(kbfirmware_data) + + diode_direction = ["COL2ROW", "ROW2COL"][kbf_data['keyboard.settings.diodeDirection']] + mcu = ["atmega32u2", "atmega32u4", "at90usb1286"][kbf_data['keyboard.controller']] + bootloader = MCU2BOOTLOADER.get(mcu, "custom") + + layout = [] + for key in kbf_data['keyboard.keys']: + layout.append({ + "matrix": [key["row"], key["col"]], + "x": key["state"]["x"], + "y": key["state"]["y"], + "w": key["state"]["w"], + "h": key["state"]["h"], + }) + + # convert to d/d info.json + info_data = { + "keyboard_name": kbf_data['keyboard.settings.name'].lower(), + "manufacturer": "TODO", + "maintainer": "TODO", + "processor": mcu, + "bootloader": bootloader, + "diode_direction": diode_direction, + "matrix_pins": { + "cols": kbf_data['keyboard.pins.col'], + "rows": kbf_data['keyboard.pins.row'], + }, + "usb": { + "vid": "0xFEED", + "pid": "0x0000", + "device_version": "0.0.1", + }, + "features": { + "bootmagic": True, + "command": False, + "console": False, + "extrakey": True, + "mousekey": True, + "nkro": True, + }, + "layouts": { + "LAYOUT": { + "layout": layout, + } + } + } + + if kbf_data['keyboard.pins.num'] or kbf_data['keyboard.pins.caps'] or kbf_data['keyboard.pins.scroll']: + indicators = {} + if kbf_data['keyboard.pins.num']: + indicators['num_lock'] = kbf_data['keyboard.pins.num'] + if kbf_data['keyboard.pins.caps']: + indicators['caps_lock'] = kbf_data['keyboard.pins.caps'] + if kbf_data['keyboard.pins.scroll']: + indicators['scroll_lock'] = kbf_data['keyboard.pins.scroll'] + info_data['indicators'] = indicators + + if kbf_data['keyboard.pins.rgb']: + info_data['rgblight'] = { + 'animations': {'all': True}, + 'led_count': kbf_data['keyboard.settings.rgbNum'], + 'pin': kbf_data['keyboard.pins.rgb'], + } + + if kbf_data['keyboard.pins.led']: + info_data['backlight'] = { + 'levels': kbf_data['keyboard.settings.backlightLevels'], + 'pin': kbf_data['keyboard.pins.led'], + } + + cli.log.warn("Support here is basic - Consider using 'qmk new-keyboard' instead") + _import_keyboard(info_data) + + +def cli_subcommand_rename(newname): + """ Gross workaround to "import" being a keyword and mlic not providing a name override + """ + def decorator(f): + f.__name__ = newname + return f + return decorator + + +@cli.argument('filename', type=FileType('r'), nargs='+', arg_only=True, help='file') +@cli.argument('-f', '--format', arg_only=True, help='Format to import (keyboard, keymap, kbfirmware) (Default: ducktype).') +@cli.subcommand('Import some stuffs') +@cli_subcommand_rename('import') +def _import(cli): + fmt = cli.args.format + filename = cli.args.filename[0] + + data = json_load(filename) + + # guess at type + if not cli.args.format: + if 'keyboard' in data and 'bounds' in data['keyboard']: + fmt = "kbfirmware" + elif 'keymap' in data: + fmt = "keymap" + else: + fmt = "keyboard" + + cli.log.info(f'{{style_bright}}Importing {filename.name} as type {fmt}.{{style_normal}}') + cli.echo('') + + if fmt == "keyboard": + _import_keyboard(data) + elif fmt == "keymap": + _import_keymap(data) + elif fmt == "kbfirmware": + _import_kbfirmware(data) From a4c39f9f871fe1b3e672a92087b59d4bfbfb9b0a Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 15 May 2022 00:29:56 +0100 Subject: [PATCH 2/5] refactor --- lib/python/qmk/cli/__init__.py | 4 +- lib/python/qmk/cli/import/__init__.py | 0 lib/python/qmk/cli/import/kbfirmware.py | 25 ++++++ lib/python/qmk/cli/import/keyboard.py | 23 ++++++ lib/python/qmk/cli/import/keymap.py | 23 ++++++ .../qmk/{cli/import.py => importers.py} | 76 ++++--------------- 6 files changed, 89 insertions(+), 62 deletions(-) create mode 100644 lib/python/qmk/cli/import/__init__.py create mode 100644 lib/python/qmk/cli/import/kbfirmware.py create mode 100644 lib/python/qmk/cli/import/keyboard.py create mode 100644 lib/python/qmk/cli/import/keymap.py rename lib/python/qmk/{cli/import.py => importers.py} (62%) diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index ea4da815afbf..0c5389769ff7 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -58,7 +58,9 @@ 'qmk.cli.generate.rules_mk', 'qmk.cli.generate.version_h', 'qmk.cli.hello', - 'qmk.cli.import', + 'qmk.cli.import.kbfirmware', + 'qmk.cli.import.keyboard', + 'qmk.cli.import.keymap', 'qmk.cli.info', 'qmk.cli.json2c', 'qmk.cli.lint', diff --git a/lib/python/qmk/cli/import/__init__.py b/lib/python/qmk/cli/import/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/python/qmk/cli/import/kbfirmware.py b/lib/python/qmk/cli/import/kbfirmware.py new file mode 100644 index 000000000000..9c03737378ca --- /dev/null +++ b/lib/python/qmk/cli/import/kbfirmware.py @@ -0,0 +1,25 @@ +from milc import cli + +from qmk.importers import import_kbfirmware as _import_kbfirmware +from qmk.path import FileType +from qmk.json_schema import json_load + + +@cli.argument('filename', type=FileType('r'), nargs='+', arg_only=True, help='file') +@cli.subcommand('Import kbfirmware json export') +def import_kbfirmware(cli): + filename = cli.args.filename[0] + + data = json_load(filename) + + cli.log.info(f'{{style_bright}}Importing {filename.name}.{{style_normal}}') + cli.echo('') + + cli.log.warn("Support here is basic - Consider using 'qmk new-keyboard' instead") + + kb_name = _import_kbfirmware(data) + + cli.log.info(f'{{fg_green}}Imported a new keyboard named {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}') + cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}{{fg_reset}},') + cli.log.info('or open the directory in your preferred text editor.') + cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.") diff --git a/lib/python/qmk/cli/import/keyboard.py b/lib/python/qmk/cli/import/keyboard.py new file mode 100644 index 000000000000..3a5ed37deef0 --- /dev/null +++ b/lib/python/qmk/cli/import/keyboard.py @@ -0,0 +1,23 @@ +from milc import cli + +from qmk.importers import import_keyboard as _import_keyboard +from qmk.path import FileType +from qmk.json_schema import json_load + + +@cli.argument('filename', type=FileType('r'), nargs='+', arg_only=True, help='file') +@cli.subcommand('Import data-driven keyboard') +def import_keyboard(cli): + filename = cli.args.filename[0] + + data = json_load(filename) + + cli.log.info(f'{{style_bright}}Importing {filename.name}.{{style_normal}}') + cli.echo('') + + kb_name = _import_keyboard(data) + + cli.log.info(f'{{fg_green}}Imported a new keyboard named {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}') + cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}{{fg_reset}},') + cli.log.info('or open the directory in your preferred text editor.') + cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.") diff --git a/lib/python/qmk/cli/import/keymap.py b/lib/python/qmk/cli/import/keymap.py new file mode 100644 index 000000000000..5bb526d1f7ad --- /dev/null +++ b/lib/python/qmk/cli/import/keymap.py @@ -0,0 +1,23 @@ +from milc import cli + +from qmk.importers import import_keymap as _import_keymap +from qmk.path import FileType +from qmk.json_schema import json_load + + +@cli.argument('filename', type=FileType('r'), nargs='+', arg_only=True, help='file') +@cli.subcommand('Import data-driven keymap') +def import_keymap(cli): + filename = cli.args.filename[0] + + data = json_load(filename) + + cli.log.info(f'{{style_bright}}Importing {filename.name}.{{style_normal}}') + cli.echo('') + + kb_name = _import_keymap(data) + + cli.log.info(f'{{fg_green}}Imported a new keymap named {{fg_cyan}}{km_name}{{fg_green}}.{{fg_reset}}') + cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}/keymaps/{km_name}{{fg_reset}},') + cli.log.info('or open the directory in your preferred text editor.') + cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km {km_name}{{fg_reset}}.") diff --git a/lib/python/qmk/cli/import.py b/lib/python/qmk/importers.py similarity index 62% rename from lib/python/qmk/cli/import.py rename to lib/python/qmk/importers.py index c1341863e275..1760effa48da 100644 --- a/lib/python/qmk/cli/import.py +++ b/lib/python/qmk/importers.py @@ -1,10 +1,8 @@ from dotty_dict import dotty import json -from milc import cli - -from qmk.json_schema import json_load, validate -from qmk.path import keyboard, keymap, FileType +from qmk.json_schema import validate +from qmk.path import keyboard, keymap from qmk.constants import MCU2BOOTLOADER @@ -22,7 +20,7 @@ def _gen_dummy_keymap(name, info_data): return json.dumps(keymap_data) -def _import_keymap(keymap_data): +def import_keymap(keymap_data): # Validate to ensure we don't have to deal with bad data - handles stdin/file validate(keymap_data, 'qmk.keymap.v1') @@ -38,13 +36,10 @@ def _import_keymap(keymap_data): # Dump out all those lovely files keyboard_keymap.write_text(json.dumps(keymap_data)) - cli.log.info(f'{{fg_green}}Imported a new keymap named {{fg_cyan}}{km_name}{{fg_green}}.{{fg_reset}}') - cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}/keymaps/{km_name}{{fg_reset}},') - cli.log.info('or open the directory in your preferred text editor.') - cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km {km_name}{{fg_reset}}.") + return km_name -def _import_keyboard(info_data): +def import_keyboard(info_data): # Validate to ensure we don't have to deal with bad data - handles stdin/file validate(info_data, 'qmk.api.keyboard.v1') @@ -55,11 +50,10 @@ def _import_keyboard(info_data): kb_name = info_data['keyboard_name'] # bail - if keyboard(kb_name).exists(): - cli.log.error(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.') - return 1 - kb_folder = keyboard(kb_name) + if kb_folder.exists(): + raise ValueError(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.') + keyboard_info = kb_folder / 'info.json' keyboard_rules = kb_folder / 'rules.mk' keyboard_keymap = kb_folder / 'keymaps' / 'default' / 'keymap.json' @@ -72,13 +66,10 @@ def _import_keyboard(info_data): keyboard_rules.write_text("# This file intentionally left blank") keyboard_keymap.write_text(_gen_dummy_keymap(kb_name, info_data)) - cli.log.info(f'{{fg_green}}Imported a new keyboard named {{fg_cyan}}{kb_name}{{fg_green}}.{{fg_reset}}') - cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}{{fg_reset}},') - cli.log.info('or open the directory in your preferred text editor.') - cli.log.info(f"And build with {{fg_yellow}}qmk compile -kb {kb_name} -km default{{fg_reset}}.") + return kb_name -def _import_kbfirmware(kbfirmware_data): +def import_kbfirmware(kbfirmware_data): kbf_data = dotty(kbfirmware_data) diode_direction = ["COL2ROW", "ROW2COL"][kbf_data['keyboard.settings.diodeDirection']] @@ -139,7 +130,9 @@ def _import_kbfirmware(kbfirmware_data): if kbf_data['keyboard.pins.rgb']: info_data['rgblight'] = { - 'animations': {'all': True}, + 'animations': { + 'all': True + }, 'led_count': kbf_data['keyboard.settings.rgbNum'], 'pin': kbf_data['keyboard.pins.rgb'], } @@ -150,44 +143,5 @@ def _import_kbfirmware(kbfirmware_data): 'pin': kbf_data['keyboard.pins.led'], } - cli.log.warn("Support here is basic - Consider using 'qmk new-keyboard' instead") - _import_keyboard(info_data) - - -def cli_subcommand_rename(newname): - """ Gross workaround to "import" being a keyword and mlic not providing a name override - """ - def decorator(f): - f.__name__ = newname - return f - return decorator - - -@cli.argument('filename', type=FileType('r'), nargs='+', arg_only=True, help='file') -@cli.argument('-f', '--format', arg_only=True, help='Format to import (keyboard, keymap, kbfirmware) (Default: ducktype).') -@cli.subcommand('Import some stuffs') -@cli_subcommand_rename('import') -def _import(cli): - fmt = cli.args.format - filename = cli.args.filename[0] - - data = json_load(filename) - - # guess at type - if not cli.args.format: - if 'keyboard' in data and 'bounds' in data['keyboard']: - fmt = "kbfirmware" - elif 'keymap' in data: - fmt = "keymap" - else: - fmt = "keyboard" - - cli.log.info(f'{{style_bright}}Importing {filename.name} as type {fmt}.{{style_normal}}') - cli.echo('') - - if fmt == "keyboard": - _import_keyboard(data) - elif fmt == "keymap": - _import_keymap(data) - elif fmt == "kbfirmware": - _import_kbfirmware(data) + # delegate as if it were a regular keyboard import + return import_keyboard(info_data) From c4acaaf71857870ebb1e3e2d49bc7f3966b4dc89 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 15 May 2022 00:37:34 +0100 Subject: [PATCH 3/5] Fix lint issues --- lib/python/qmk/cli/import/keymap.py | 2 +- lib/python/qmk/importers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/python/qmk/cli/import/keymap.py b/lib/python/qmk/cli/import/keymap.py index 5bb526d1f7ad..a499c9348050 100644 --- a/lib/python/qmk/cli/import/keymap.py +++ b/lib/python/qmk/cli/import/keymap.py @@ -15,7 +15,7 @@ def import_keymap(cli): cli.log.info(f'{{style_bright}}Importing {filename.name}.{{style_normal}}') cli.echo('') - kb_name = _import_keymap(data) + kb_name, km_name = _import_keymap(data) cli.log.info(f'{{fg_green}}Imported a new keymap named {{fg_cyan}}{km_name}{{fg_green}}.{{fg_reset}}') cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}keyboards/{kb_name}/keymaps/{km_name}{{fg_reset}},') diff --git a/lib/python/qmk/importers.py b/lib/python/qmk/importers.py index 1760effa48da..c0202efaf8ec 100644 --- a/lib/python/qmk/importers.py +++ b/lib/python/qmk/importers.py @@ -36,7 +36,7 @@ def import_keymap(keymap_data): # Dump out all those lovely files keyboard_keymap.write_text(json.dumps(keymap_data)) - return km_name + return (kb_name, km_name) def import_keyboard(info_data): From 240d8a7e084101ece163479774c2f08f3d247f8b Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 15 May 2022 00:44:26 +0100 Subject: [PATCH 4/5] Format output --- lib/python/qmk/importers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/python/qmk/importers.py b/lib/python/qmk/importers.py index c0202efaf8ec..f9ecac02aeba 100644 --- a/lib/python/qmk/importers.py +++ b/lib/python/qmk/importers.py @@ -4,6 +4,7 @@ from qmk.json_schema import validate from qmk.path import keyboard, keymap from qmk.constants import MCU2BOOTLOADER +from qmk.json_encoders import InfoJSONEncoder, KeymapJSONEncoder def _gen_dummy_keymap(name, info_data): @@ -17,7 +18,7 @@ def _gen_dummy_keymap(name, info_data): "layers": [["KC_NO" for _ in range(0, layout_length)]], } - return json.dumps(keymap_data) + return json.dumps(keymap_data, cls=KeymapJSONEncoder) def import_keymap(keymap_data): @@ -34,7 +35,7 @@ def import_keymap(keymap_data): keyboard_keymap.parent.mkdir(parents=True, exist_ok=True) # Dump out all those lovely files - keyboard_keymap.write_text(json.dumps(keymap_data)) + keyboard_keymap.write_text(json.dumps(keymap_data, cls=KeymapJSONEncoder)) return (kb_name, km_name) @@ -62,7 +63,7 @@ def import_keyboard(info_data): keyboard_keymap.parent.mkdir(parents=True, exist_ok=True) # Dump out all those lovely files - keyboard_info.write_text(json.dumps(info_data)) + keyboard_info.write_text(json.dumps(info_data, cls=InfoJSONEncoder)) keyboard_rules.write_text("# This file intentionally left blank") keyboard_keymap.write_text(_gen_dummy_keymap(kb_name, info_data)) From f2093c3ae2e09c53d0c2d6ee80b8363d1bae990d Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 15 May 2022 01:03:08 +0100 Subject: [PATCH 5/5] Add some docs? --- docs/cli_commands.md | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/docs/cli_commands.md b/docs/cli_commands.md index a380d3eb2f1d..56767d962bf8 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -352,6 +352,73 @@ $ qmk via2json -kb ai03/polaris -o polaris_keymap.json polaris_via_backup.json Ψ Wrote keymap to /home/you/qmk_firmware/polaris_keymap.json ``` +## `qmk import-keyboard` + +This command imports a data-driven `info.json` keyboard into the repo. + +**Usage**: + +``` +usage: qmk import-keyboard [-h] filename +``` + +**Example:** + +``` +$ qmk import-keyboard ~/Downloads/forever60.json +Ψ Importing forever60.json. + +Ψ Imported a new keyboard named forever60. +Ψ To start working on things, `cd` into keyboards/forever60, +Ψ or open the directory in your preferred text editor. +Ψ And build with qmk compile -kb forever60 -km default. +``` + +## `qmk import-keymap` + +This command imports a data-driven `keymap.json` keymap into the repo. + +**Usage**: + +``` +usage: qmk import-keymap [-h] filename +``` + +**Example:** + +``` +qmk import-keymap ~/Downloads/asdf2.json +Ψ Importing asdf2.json. + +Ψ Imported a new keymap named asdf2. +Ψ To start working on things, `cd` into keyboards/takashicompany/dogtag/keymaps/asdf2, +Ψ or open the directory in your preferred text editor. +Ψ And build with qmk compile -kb takashicompany/dogtag -km asdf2. +``` + +## `qmk import-kbfirmware` + +This command creates a new keyboard based on a [Keyboard Firmware Builder](https://kbfirmware.com/) export. + +**Usage**: + +``` +usage: qmk import-kbfirmware [-h] filename +``` + +**Example:** + +``` +$ qmk import-kbfirmware ~/Downloads/gh62.json +Ψ Importing gh62.json. + +⚠ Support here is basic - Consider using 'qmk new-keyboard' instead +Ψ Imported a new keyboard named gh62. +Ψ To start working on things, `cd` into keyboards/gh62, +Ψ or open the directory in your preferred text editor. +Ψ And build with qmk compile -kb gh62 -km default. +``` + --- # Developer Commands @@ -527,3 +594,4 @@ This command converts a TTF font to an intermediate format for editing, before c ## `qmk painter-convert-font-image` This command converts an intermediate font image to the QFF File Format. See the [Quantum Painter](quantum_painter.md?id=quantum-painter-cli) documentation for more information on this command. +