aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/list/keymaps.py
diff options
context:
space:
mode:
authorErovia <erovia@users.noreply.github.com>2020-01-12 12:36:41 +0100
committerskullydazed <skullydazed@users.noreply.github.com>2020-02-15 15:19:03 -0800
commit3db41817e0aa72e1406e29a4fb5f82db0c2a6cf1 (patch)
tree7a23300edcf429f1b46ce8a481431f715dfeb7c4 /lib/python/qmk/cli/list/keymaps.py
parent8eeab1112aa1ca7336f88867a9a2ab680ae94b53 (diff)
downloadqmk_firmware-3db41817e0aa72e1406e29a4fb5f82db0c2a6cf1.tar.gz
qmk_firmware-3db41817e0aa72e1406e29a4fb5f82db0c2a6cf1.zip
Code cleanup, use pathlib, use pytest keyboard
Clean up checks and logics that are unnecessary due to MILC updates. Use pathlib instead of os.path for readability. Use the 'pytest' keyboard for the tests. Add community layout for 'handwired/onekey/pytest' so we can test community layouts.
Diffstat (limited to 'lib/python/qmk/cli/list/keymaps.py')
-rw-r--r--lib/python/qmk/cli/list/keymaps.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/python/qmk/cli/list/keymaps.py b/lib/python/qmk/cli/list/keymaps.py
index aab973140..d199d29bc 100644
--- a/lib/python/qmk/cli/list/keymaps.py
+++ b/lib/python/qmk/cli/list/keymaps.py
@@ -10,17 +10,13 @@ from qmk.errors import NoSuchKeyboardError
10def list_keymaps(cli): 10def list_keymaps(cli):
11 """List the keymaps for a specific keyboard 11 """List the keymaps for a specific keyboard
12 """ 12 """
13 # ask for user input if keyboard was not provided in the command line
14 if cli.args.keyboard:
15 cli.config.list_keymaps.keyboard = cli.args.keyboard
16 elif not cli.config.list_keymaps.keyboard:
17 cli.config.list_keymaps.keyboard = input("Keyboard Name: ")
18
19 try: 13 try:
20 for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard): 14 for name in qmk.keymap.list_keymaps(cli.config.list_keymaps.keyboard):
21 # We echo instead of cli.log.info to allow easier piping of this output 15 # We echo instead of cli.log.info to allow easier piping of this output
22 cli.echo('%s:%s', cli.config.list_keymaps.keyboard, name) 16 cli.echo('%s', name)
23 except NoSuchKeyboardError as e: 17 except NoSuchKeyboardError as e:
24 cli.echo("{fg_red}%s: %s", cli.config.list_keymaps.keyboard, e.message) 18 cli.echo("{fg_red}%s: %s", cli.config.list_keymaps.keyboard, e.message)
25 except (FileNotFoundError, PermissionError) as e: 19 except (FileNotFoundError, PermissionError) as e:
26 cli.echo("{fg_red}%s: %s", cli.config.list_keymaps.keyboard, e) 20 cli.echo("{fg_red}%s: %s", cli.config.list_keymaps.keyboard, e)
21 except TypeError:
22 cli.echo("{fg_red}Something went wrong. Did you specify a keyboard?")