summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/list
diff options
context:
space:
mode:
authorZach White <skullydazed@users.noreply.github.com>2020-05-26 13:05:41 -0700
committerDrashna Jael're <drashna@live.com>2020-08-08 20:31:13 -0700
commitec8c10ac1bd939bd210d1047f4d9d7c4dfca456d (patch)
tree33e494ba22ada101ed0b630453fbfb50792d4333 /lib/python/qmk/cli/list
parent5ea1cd3526ff49ef61cbe728409782994b83bf1b (diff)
[CLI] Add a subcommand for getting information about a keyboard (#8666)
You can now use `qmk info` to get information about keyboards and keymaps. Co-authored-by: Erovia <Erovia@users.noreply.github.com>
Diffstat (limited to 'lib/python/qmk/cli/list')
-rw-r--r--lib/python/qmk/cli/list/keymaps.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/python/qmk/cli/list/keymaps.py b/lib/python/qmk/cli/list/keymaps.py
index cec9ca0224..b18289eb35 100644
--- a/lib/python/qmk/cli/list/keymaps.py
+++ b/lib/python/qmk/cli/list/keymaps.py
@@ -4,7 +4,7 @@ from milc import cli
import qmk.keymap
from qmk.decorators import automagic_keyboard
-from qmk.errors import NoSuchKeyboardError
+from qmk.path import is_keyboard
@cli.argument("-kb", "--keyboard", help="Specify keyboard name. Example: 1upkeyboards/1up60hse")
@@ -13,13 +13,9 @@ from qmk.errors import NoSuchKeyboardError
def list_keymaps(cli):
"""List the keymaps for a specific keyboard
"""
- try:
- for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
- # We echo instead of cli.log.info to allow easier piping of this output
- cli.echo('%s', name)
- except NoSuchKeyboardError as e:
- cli.echo("{fg_red}%s: %s", cli.config.list_keymaps.keyboard, e.message)
- except (FileNotFoundError, PermissionError) as e:
- cli.echo("{fg_red}%s: %s", cli.config.list_keymaps.keyboard, e)
- except TypeError:
- cli.echo("{fg_red}Something went wrong. Did you specify a keyboard?")
+ if not is_keyboard(cli.config.list_keymaps.keyboard):
+ cli.log.error('Keyboard %s does not exist!', cli.config.list_keymaps.keyboard)
+ exit(1)
+
+ for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
+ print(name)