summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/list
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-11-19 04:55:07 +1100
committerGitHub <noreply@github.com>2021-11-18 17:55:07 +0000
commitaee10ccc5c80e71977cbbccb5b86059c87ba7d48 (patch)
tree104f6a379857beb967142c9d2e4238fff2029cba /lib/python/qmk/cli/list
parentcd50fdf7ee6cdb1a5025f4e3e9540c0fd00499a7 (diff)
[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>
Diffstat (limited to 'lib/python/qmk/cli/list')
-rw-r--r--lib/python/qmk/cli/list/keymaps.py5
-rw-r--r--lib/python/qmk/cli/list/layouts.py5
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/list/keymaps.py b/lib/python/qmk/cli/list/keymaps.py
index d79ab75b58..d2ef136c06 100644
--- a/lib/python/qmk/cli/list/keymaps.py
+++ b/lib/python/qmk/cli/list/keymaps.py
@@ -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)
diff --git a/lib/python/qmk/cli/list/layouts.py b/lib/python/qmk/cli/list/layouts.py
index 8e07afeeca..df593dc390 100644
--- a/lib/python/qmk/cli/list/layouts.py
+++ b/lib/python/qmk/cli/list/layouts.py
@@ -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)