CLI: update subcommands to use return instead of exit() (#10323)
This commit is contained in:
parent
2013f63134
commit
2c9ffd4739
9 changed files with 20 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue