qmk_firmware/lib/python/qmk/cli/list/layouts.py
Ryan aee10ccc5c
[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>
2021-11-18 17:55:07 +00:00

24 lines
832 B
Python

"""List the keymaps for a specific keyboard
"""
from milc import cli
from qmk.decorators import automagic_keyboard
from qmk.keyboard import keyboard_completer, keyboard_folder
from qmk.info import info_json
@cli.argument("-kb", "--keyboard", type=keyboard_folder, completer=keyboard_completer, help="Specify keyboard name. Example: monarch")
@cli.subcommand("List the layouts for a specific keyboard")
@automagic_keyboard
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)