1
0
Fork 0

[CLI] list-keymaps/list-layouts: Check keyboard passed in (#15204)

* [CLI] `list-keymaps`/`list-layouts`: Check keyboard passed in

* Update lib/python/qmk/cli/list/keymaps.py

Co-authored-by: Joel Challis <git@zvecr.com>

* Update lib/python/qmk/cli/list/layouts.py

Co-authored-by: Joel Challis <git@zvecr.com>

Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
Ryan 2021-11-19 04:55:07 +11:00 committed by GitHub
parent cd50fdf7ee
commit aee10ccc5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -13,5 +13,10 @@ from qmk.keyboard import keyboard_completer, keyboard_folder
def list_keymaps(cli):
"""List the keymaps for a specific keyboard
"""
if not cli.config.list_keymaps.keyboard:
cli.log.error('Missing required arguments: --keyboard')
cli.subcommands['list-keymaps'].print_help()
return False
for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
print(name)

View file

@ -13,6 +13,11 @@ from qmk.info import info_json
def list_layouts(cli):
"""List the layouts for a specific keyboard
"""
if not cli.config.list_layouts.keyboard:
cli.log.error('Missing required arguments: --keyboard')
cli.subcommands['list-layouts'].print_help()
return False
info_data = info_json(cli.config.list_layouts.keyboard)
for name in sorted(info_data.get('community_layouts', [])):
print(name)