summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2022-02-28 20:03:22 +0000
committerQMK Bot <hello@qmk.fm>2022-02-28 20:03:22 +0000
commit36e47cb3aaa6380764ab23e2b0308bf689156aa7 (patch)
treef762d5f9f497432cb4dca6fa016c254f1065de9b /lib/python/qmk/cli
parent3c7c9bdd8614cd332b4db7ab6d05429d513ba11d (diff)
parentfbfd5312b995a32af690c183cad0dc988f695e89 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-xlib/python/qmk/cli/json2c.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/python/qmk/cli/json2c.py b/lib/python/qmk/cli/json2c.py
index ae8248e6b7..2873a9bfd3 100755
--- a/lib/python/qmk/cli/json2c.py
+++ b/lib/python/qmk/cli/json2c.py
@@ -1,12 +1,11 @@
"""Generate a keymap.c from a configurator export.
"""
-import json
-
from argcomplete.completers import FilesCompleter
from milc import cli
import qmk.keymap
import qmk.path
+from qmk.commands import parse_configurator_json
@cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')
@@ -19,14 +18,8 @@ def json2c(cli):
This command uses the `qmk.keymap` module to generate a keymap.c from a configurator export. The generated keymap is written to stdout, or to a file if -o is provided.
"""
- try:
- # Parse the configurator from json file (or stdin)
- user_keymap = json.load(cli.args.filename)
-
- except json.decoder.JSONDecodeError as ex:
- cli.log.error('The JSON input does not appear to be valid.')
- cli.log.error(ex)
- return False
+ # Parse the configurator from json file (or stdin)
+ user_keymap = parse_configurator_json(cli.args.filename)
# Environment processing
if cli.args.output and cli.args.output.name == '-':