summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-xlib/python/qmk/cli/doctor.py4
-rwxr-xr-xlib/python/qmk/cli/info.py11
-rwxr-xr-xlib/python/qmk/cli/json/keymap.py2
-rwxr-xr-xlib/python/qmk/cli/json2c.py4
-rwxr-xr-xlib/python/qmk/cli/kle2json.py6
-rw-r--r--lib/python/qmk/cli/list/keymaps.py2
-rwxr-xr-xlib/python/qmk/cli/new/keymap.py6
7 files changed, 17 insertions, 18 deletions
diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py
index 5341159dac..984c308d1e 100755
--- a/lib/python/qmk/cli/doctor.py
+++ b/lib/python/qmk/cli/doctor.py
@@ -363,4 +363,6 @@ def doctor(cli):
cli.log.info('{fg_green}QMK is ready to go')
else:
cli.log.info('{fg_yellow}Problems detected, please fix these problems before proceeding.')
- # FIXME(skullydazed/unclaimed): Link to a document about troubleshooting, or discord or something \ No newline at end of file
+ # FIXME(skullydazed/unclaimed): Link to a document about troubleshooting, or discord or something
+
+ return ok
diff --git a/lib/python/qmk/cli/info.py b/lib/python/qmk/cli/info.py
index 5e4b391411..0e64d40742 100755
--- a/lib/python/qmk/cli/info.py
+++ b/lib/python/qmk/cli/info.py
@@ -134,11 +134,11 @@ def info(cli):
if not cli.config.info.keyboard:
cli.log.error('Missing paramater: --keyboard')
cli.subcommands['info'].print_help()
- exit(1)
+ return False
if not is_keyboard(cli.config.info.keyboard):
cli.log.error('Invalid keyboard: "%s"', cli.config.info.keyboard)
- exit(1)
+ return False
# Build the info.json file
kb_info_json = info_json(cli.config.info.keyboard)
@@ -146,13 +146,10 @@ def info(cli):
# Output in the requested format
if cli.args.format == 'json':
print(json.dumps(kb_info_json))
- exit()
-
- if cli.args.format == 'text':
+ elif cli.args.format == 'text':
print_text_output(kb_info_json)
-
elif cli.args.format == 'friendly':
print_friendly_output(kb_info_json)
-
else:
cli.log.error('Unknown format: %s', cli.args.format)
+ return False
diff --git a/lib/python/qmk/cli/json/keymap.py b/lib/python/qmk/cli/json/keymap.py
index c97a2d0462..2af9faaa72 100755
--- a/lib/python/qmk/cli/json/keymap.py
+++ b/lib/python/qmk/cli/json/keymap.py
@@ -13,4 +13,4 @@ def json_keymap(cli):
"""Renamed to `qmk json2c`.
"""
cli.log.error('This command has been renamed to `qmk json2c`.')
- exit(1)
+ return False
diff --git a/lib/python/qmk/cli/json2c.py b/lib/python/qmk/cli/json2c.py
index af0d80a9ac..2a90094368 100755
--- a/lib/python/qmk/cli/json2c.py
+++ b/lib/python/qmk/cli/json2c.py
@@ -22,12 +22,12 @@ def json2c(cli):
# TODO(skullydazed/anyone): Read file contents from STDIN
cli.log.error('Reading from STDIN is not (yet) supported.')
cli.print_usage()
- exit(1)
+ return False
if not cli.args.filename.exists():
cli.log.error('JSON file does not exist!')
cli.print_usage()
- exit(1)
+ return False
# Environment processing
if cli.args.output and cli.args.output.name == '-':
diff --git a/lib/python/qmk/cli/kle2json.py b/lib/python/qmk/cli/kle2json.py
index 798f95fd19..3d1bb8c43c 100755
--- a/lib/python/qmk/cli/kle2json.py
+++ b/lib/python/qmk/cli/kle2json.py
@@ -37,7 +37,8 @@ def kle2json(cli):
file_path = Path(os.environ['ORIG_CWD'], cli.args.filename)
# Check for valid file_path for more graceful failure
if not file_path.exists():
- return cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', file_path)
+ cli.log.error('File {fg_cyan}%s{style_reset_all} was not found.', file_path)
+ return False
out_path = file_path.parent
raw_code = file_path.open().read()
# Check if info.json exists, allow overwrite with force
@@ -50,8 +51,7 @@ def kle2json(cli):
except Exception as e:
cli.log.error('Could not parse KLE raw data: %s', raw_code)
cli.log.exception(e)
- # FIXME: This should be better
- return cli.log.error('Could not parse KLE raw data.')
+ return False
keyboard = OrderedDict(
keyboard_name=kle.name,
url='',
diff --git a/lib/python/qmk/cli/list/keymaps.py b/lib/python/qmk/cli/list/keymaps.py
index b18289eb35..49bc84b2ce 100644
--- a/lib/python/qmk/cli/list/keymaps.py
+++ b/lib/python/qmk/cli/list/keymaps.py
@@ -15,7 +15,7 @@ def list_keymaps(cli):
"""
if not is_keyboard(cli.config.list_keymaps.keyboard):
cli.log.error('Keyboard %s does not exist!', cli.config.list_keymaps.keyboard)
- exit(1)
+ return False
for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
print(name)
diff --git a/lib/python/qmk/cli/new/keymap.py b/lib/python/qmk/cli/new/keymap.py
index 474fe7974f..52c564997b 100755
--- a/lib/python/qmk/cli/new/keymap.py
+++ b/lib/python/qmk/cli/new/keymap.py
@@ -29,15 +29,15 @@ def new_keymap(cli):
# check directories
if not kb_path.exists():
cli.log.error('Keyboard %s does not exist!', kb_path)
- exit(1)
+ return False
if not keymap_path_default.exists():
cli.log.error('Keyboard default %s does not exist!', keymap_path_default)
- exit(1)
+ return False
if keymap_path_new.exists():
cli.log.error('Keymap %s already exists!', keymap_path_new)
- exit(1)
+ return False
# create user directory with default keymap files
shutil.copytree(keymap_path_default, keymap_path_new, symlinks=True)