summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
authorErovia <Erovia@users.noreply.github.com>2020-05-26 17:43:33 +0200
committerDrashna Jael're <drashna@live.com>2020-08-08 20:29:03 -0700
commit5ea1cd3526ff49ef61cbe728409782994b83bf1b (patch)
treedaef51d92dbe6cea37defb368c2800223284470d /lib/python/qmk/cli
parent4db676c64d5384b75342b786a82c068145d132db (diff)
CLI: fix `json2c` subcommand and add/fix tests (#9206)
Co-authored-by: Zach White <skullydazed@users.noreply.github.com>
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-xlib/python/qmk/cli/json2c.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/python/qmk/cli/json2c.py b/lib/python/qmk/cli/json2c.py
index 5218405070..af0d80a9ac 100755
--- a/lib/python/qmk/cli/json2c.py
+++ b/lib/python/qmk/cli/json2c.py
@@ -18,19 +18,19 @@ 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.
"""
# Error checking
- if not cli.args.filename.exists():
- cli.log.error('JSON file does not exist!')
+ if cli.args.filename and cli.args.filename.name == '-':
+ # TODO(skullydazed/anyone): Read file contents from STDIN
+ cli.log.error('Reading from STDIN is not (yet) supported.')
cli.print_usage()
exit(1)
- if cli.args.filename.name == '-':
- # TODO(skullydazed/anyone): Read file contents from STDIN
- cli.log.error('Reading from STDIN is not (yet) supported.')
+ if not cli.args.filename.exists():
+ cli.log.error('JSON file does not exist!')
cli.print_usage()
exit(1)
# Environment processing
- if cli.args.output.name == ('-'):
+ if cli.args.output and cli.args.output.name == '-':
cli.args.output = None
# Parse the configurator json