aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/decorators.py
diff options
context:
space:
mode:
authorZach White <skullydazed@users.noreply.github.com>2020-05-26 13:05:41 -0700
committerGitHub <noreply@github.com>2020-05-26 13:05:41 -0700
commit751316c34465ea77e066c3052729b207f3d62e0c (patch)
treecb99656b93c156757e2fd7c84fe716f9c300ca89 /lib/python/qmk/decorators.py
parent5d3bf8a050f3c0beb1f91147dc1ab54de36cbb05 (diff)
downloadqmk_firmware-751316c34465ea77e066c3052729b207f3d62e0c.tar.gz
qmk_firmware-751316c34465ea77e066c3052729b207f3d62e0c.zip
[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/decorators.py')
-rw-r--r--lib/python/qmk/decorators.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/python/qmk/decorators.py b/lib/python/qmk/decorators.py
index 94e14bf37..f8f2facb1 100644
--- a/lib/python/qmk/decorators.py
+++ b/lib/python/qmk/decorators.py
@@ -5,7 +5,8 @@ from pathlib import Path
5 5
6from milc import cli 6from milc import cli
7 7
8from qmk.path import is_keyboard, is_keymap_dir, under_qmk_firmware 8from qmk.keymap import is_keymap_dir
9from qmk.path import is_keyboard, under_qmk_firmware
9 10
10 11
11def automagic_keyboard(func): 12def automagic_keyboard(func):
@@ -67,18 +68,18 @@ def automagic_keymap(func):
67 while current_path.parent.name != 'keymaps': 68 while current_path.parent.name != 'keymaps':
68 current_path = current_path.parent 69 current_path = current_path.parent
69 cli.config[cli._entrypoint.__name__]['keymap'] = current_path.name 70 cli.config[cli._entrypoint.__name__]['keymap'] = current_path.name
70 cli.config_source[cli._entrypoint.__name__]['keyboard'] = 'keymap_directory' 71 cli.config_source[cli._entrypoint.__name__]['keymap'] = 'keymap_directory'
71 72
72 # If we're in `qmk_firmware/layouts` guess the name from the community keymap they're in 73 # If we're in `qmk_firmware/layouts` guess the name from the community keymap they're in
73 elif relative_cwd.parts[0] == 'layouts' and is_keymap_dir(relative_cwd): 74 elif relative_cwd.parts[0] == 'layouts' and is_keymap_dir(relative_cwd):
74 cli.config[cli._entrypoint.__name__]['keymap'] = relative_cwd.name 75 cli.config[cli._entrypoint.__name__]['keymap'] = relative_cwd.name
75 cli.config_source[cli._entrypoint.__name__]['keyboard'] = 'layouts_directory' 76 cli.config_source[cli._entrypoint.__name__]['keymap'] = 'layouts_directory'
76 77
77 # If we're in `qmk_firmware/users` guess the name from the userspace they're in 78 # If we're in `qmk_firmware/users` guess the name from the userspace they're in
78 elif relative_cwd.parts[0] == 'users': 79 elif relative_cwd.parts[0] == 'users':
79 # Guess the keymap name based on which userspace they're in 80 # Guess the keymap name based on which userspace they're in
80 cli.config[cli._entrypoint.__name__]['keymap'] = relative_cwd.parts[1] 81 cli.config[cli._entrypoint.__name__]['keymap'] = relative_cwd.parts[1]
81 cli.config_source[cli._entrypoint.__name__]['keyboard'] = 'users_directory' 82 cli.config_source[cli._entrypoint.__name__]['keymap'] = 'users_directory'
82 83
83 return func(*args, **kwargs) 84 return func(*args, **kwargs)
84 85