1
0
Fork 0

CLI: update subcommands to use return instead of exit() (#10323)

This commit is contained in:
Ryan 2020-10-07 10:46:10 +11:00 committed by GitHub
parent 2013f63134
commit 2c9ffd4739
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 20 additions and 18 deletions

View file

@ -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='',